nerdexam
GIAC

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.

Linux and Cryptography

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)
  • A
    5% (3)
  • B
    82% (50)
  • C
    13% (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.

Arm private.txt #11 Nov 2009 02:59:58 am

The rm command removes files entirely and has no functionality for modifying timestamps; the comment syntax used is also not valid for this purpose.

Btouch -d "11 Nov 2009 02:59:58 am" private.txtCorrect

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.

Ctouch private.txt #11 Nov 2009 02:59:58 am

touch private.txt without any options simply updates the file's timestamps to the current system time, not a specified date.

Dtouch -t 200911110259.58 private.txtCorrect

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

#touch command#Linux file timestamps#file modification#Linux CLI

Community Discussion

No community discussion yet for this question.

Full GSEC Practice