GSEC · Question #159
John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux- based network. John is working as a root user on the Linux operating system. He wants to change the modified…
The correct answer is B. touch -d "11 Nov 2009 02:59:58 am" private.txt D. touch -t 200911110259.58 private.txt. The Linux touch command can modify file timestamps using either the -d flag for human-readable date strings or the -t flag for a formatted timestamp.
Question
John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux- based network. John is working as a root user on the Linux operating system. He wants to change the modified date and time of the file private.txt to 11 Nov 2009 02:59:58 am. Which of the following commands will John use to accomplish his task? Each correct answer represents a complete solution. Choose all that apply.
Options
- Arm private.txt #11 Nov 2009 02:59:58 am
- Btouch -d "11 Nov 2009 02:59:58 am" private.txt
- Ctouch private.txt #11 Nov 2009 02:59:58 am
- Dtouch -t 200911110259.58 private.txt
How the community answered
(61 responses)- A5% (3)
- B82% (50)
- C13% (8)
Why each option
The Linux touch command can modify file timestamps using either the -d flag for human-readable date strings or the -t flag for a formatted timestamp.
The rm command removes files entirely and has no functionality for modifying timestamps; the comment syntax used is also not valid for this purpose.
touch -d accepts a free-form human-readable date string such as '11 Nov 2009 02:59:58 am' and sets the file's modification and access times accordingly.
touch private.txt without any options simply updates the file's timestamps to the current system time, not a specified date.
touch -t accepts a timestamp in the format [[CC]YY]MMDDhhmm[.ss], so 200911110259.58 correctly encodes year 2009, month 11, day 11, hour 02, minute 59, and 58 seconds.
Concept tested: Linux touch command timestamp modification options
Source: https://www.man7.org/linux/man-pages/man1/touch.1.html
Topics
Community Discussion
No community discussion yet for this question.