Recall & Review
beginner
What does the
touch command do in Linux?The
touch command creates an empty file if it does not exist or updates the file's last modified time if it does exist.Click to reveal answer
beginner
How do you create multiple empty files at once using
touch?You list all the file names separated by spaces after
touch. For example: touch file1.txt file2.txt file3.txt creates three empty files.Click to reveal answer
beginner
What happens if you use
touch on a file that already exists?The file's last access and modification timestamps are updated to the current time, but the file content stays the same.
Click to reveal answer
intermediate
How can you use
touch to create a file with a specific timestamp?Use the
-t option followed by the timestamp in the format [[CC]YY]MMDDhhmm[.ss]. For example: touch -t 202401011200 file.txt sets the file's timestamp to Jan 1, 2024, 12:00.Click to reveal answer
beginner
Why might you use
touch in scripting or automation?You can create placeholder files, update timestamps to trigger other processes, or ensure files exist before running commands that need them.
Click to reveal answer
What does the command
touch newfile.txt do if newfile.txt does not exist?✗ Incorrect
touch creates an empty file if it does not exist.
If
file.txt exists, what does touch file.txt do?✗ Incorrect
touch updates the file's timestamps without changing its content.
How can you create three empty files named a.txt, b.txt, and c.txt in one command?
✗ Incorrect
Listing multiple file names after touch creates all of them.
Which option with
touch lets you set a custom timestamp?✗ Incorrect
The -t option sets a specific timestamp for the file.
Why might a script use
touch before running another command?✗ Incorrect
touch ensures files exist or updates timestamps to trigger other actions.
Explain how the
touch command works and give two common uses.Think about creating files and changing file times.
You got /4 concepts.
Describe how to use
touch to set a file's timestamp to a specific date and time.Look for the option that controls time.
You got /3 concepts.