Bird
0
0

Which of the following is the correct syntax to create an empty file named logfile.log using touch?

easy📝 Syntax Q3 of 15
Linux CLI - File and Directory Operations
Which of the following is the correct syntax to create an empty file named logfile.log using touch?
Atouch --create logfile.log
Btouch -c logfile.log
Ctouch logfile.log
Dtouch > logfile.log
Step-by-Step Solution
Solution:
  1. Step 1: Recall the basic touch syntax

    The basic syntax to create or update a file is simply touch filename.
  2. Step 2: Check options and redirection

    touch -c logfile.log uses -c which means do not create, so it won't create a new file. touch --create logfile.log is invalid. touch > logfile.log uses shell redirection, which truncates or creates but is not touch syntax.
  3. Final Answer:

    touch logfile.log -> Option C
  4. Quick Check:

    Basic touch syntax = C [OK]
Quick Trick: touch filename creates or updates file timestamp [OK]
Common Mistakes:
MISTAKES
  • Using invalid options like --create
  • Confusing shell redirection with touch
  • Using -c which prevents file creation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes