101-500 practice question 11 of 30
Which of the following commands will NOT update the modify timestamp on the file /tmp/myfile.txt?
Full set: 246 questionsThe file command is a read-only utility that inspects a file's content to determine its type. This action only requires reading the file, which may update the access timestamp (atime) but does not modify the file's data or its metadata. Therefore, the modification timestamp (mtime) remains unchanged. All other options involve writing to the file, either by overwriting, appending, in-place editing, or explicitly updating timestamps, all of which change the mtime.
B. echo "Hello" >/tmp/myfile.txt: The > redirection operator overwrites the file's content, which is a modification that updates mtime.
C. sed -ie "s/1/2/" /tmp/myfile.txt: The sed -i command edits the file in-place, directly modifying its content and thus updating mtime.
D. echo -n "Hello" >>/tmp/myfile.txt: The >> redirection operator appends data to the end of the file, which is a modification that updates mtime.
E. touch /tmp/myfile.txt: The touch command's primary function is to update a file's access and modification timestamps to the current time.
1. Free Software Foundation. (2020). GNU Coreutils Manual. Section 27.1, "touch: Change file timestamps". Retrieved from https://www.gnu.org/software/coreutils/manual/htmlnode/touch-invocation.html
2. Linux man-pages project. (2021). stat(2) — get file status. "The stmtime field is the time of the last modification of file data." Retrieved from https://man7.org/linux/man-pages/man2/stat.2.html
3. Linux man-pages project. (2021). file(1) — determine file type. The description outlines a read-only inspection process. Retrieved from https://man7.org/linux/man-pages/man1/file.1.html
Keep practicing
Take the free 101-500 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 101-500 practice questions
- Question 1Which of the following commands prints a list of available package updates when using RPM…
- Question 2Which of the following commands changes the number of days before the ext3 filesystem on …
- Question 3During a system boot cycle, what program is executed after the BIOS completes its tasks?
- Question 4Which of the following commands reboots the system when using SysV init? (Choose TWO corr…
- Question 5Which of the following commands updates the linker cache of shared libraries?
- Question 6Which of the following commands can be used to create a USB storage media from a disk ima…
