Bird
0
0

What happens if you use the touch command on a file that already exists?

easy📝 Conceptual Q1 of 15
Linux CLI - File and Directory Operations
What happens if you use the touch command on a file that already exists?
AIt shows an error saying the file exists
BIt deletes the file and creates a new empty one
CIt updates the file's last modified timestamp without changing content
DIt renames the file to a new name
Step-by-Step Solution
Solution:
  1. Step 1: Understand the touch command behavior on existing files

    The touch command updates the last access and modification times of a file if it exists, without altering its content.
  2. Step 2: Compare options with this behavior

    Only It updates the file's last modified timestamp without changing content correctly states that the timestamp is updated without changing the file content.
  3. Final Answer:

    It updates the file's last modified timestamp without changing content -> Option C
  4. Quick Check:

    touch updates timestamp = A [OK]
Quick Trick: touch updates timestamps, does not delete or rename files [OK]
Common Mistakes:
MISTAKES
  • Thinking touch deletes and recreates files
  • Expecting an error if file exists
  • Assuming touch renames files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes