nerdexam
GIAC

GSEC · Question #159

GSEC Question #159: Real Exam Question with Answer & Explanation

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

Explanation

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.

Common mistakes.

  • A. The rm command removes files entirely and has no functionality for modifying timestamps; the comment syntax used is also not valid for this purpose.
  • C. touch private.txt without any options simply updates the file's timestamps to the current system time, not a specified date.

Concept tested. Linux touch command timestamp modification options

Reference. https://www.man7.org/linux/man-pages/man1/touch.1.html

Community Discussion

No community discussion yet for this question.

Full GSEC Practice