Courseiva
Essential CommandshardMultiple SelectObjective-mapped

LFCS Essential Commands Practice Question

Which TWO commands can be used to create a new empty file?

⚠ Common exam trap

It's easy for candidates to think `echo 'text' > file` creates an empty file because they focus on the redirection operator, but the echo command always writes at least a newline, so the file is not empty.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

touch file

The `touch` command is specifically designed to create an empty file if it does not already exist, or update its timestamps if it does. Option D is correct because using the shell redirection operator `>` with no command before it (or with a null command) creates an empty file by truncating any existing content or creating a new zero-byte file.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • touch file

    Why this is correct

    Creates an empty file if it does not exist.

  • mkdir file

    Why it's wrong here

    Creates a directory, not a file.

  • cat file

    Why it's wrong here

    Concatenates file content, does not create.

  • > file

    Why this is correct

    Shell redirection creates an empty file.

  • echo 'text' > file

    Why it's wrong here

    Creates a file with content, not empty.

About these practice questions

This LFCS question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.