Linux Foundation Certified System Administrator (LFCS) — Question 47
Which of the following commands will NOT update the modify timestamp on the file /tmp/myfile.txt?
Answer options
- A. file /tmp/myfile.txt
- B. echo "Hello" >/tmp/myfile.txt
- C. sed -ie "s/1/2/" /tmp/myfile.txt
- D. echo -n "Hello" >>/tmp/myfile.txt
- E. touch /tmp/myfile.txt
Correct answer: A
Explanation
The command 'file /tmp/myfile.txt' is used to determine the type of the file and does not modify it, hence it does not update the timestamp. In contrast, the other commands either write to the file or alter its contents, resulting in an updated modification timestamp.