nerdexam
LPI

010-100 · Question #74

Which of the following commands will display a list all files in the current directory including the hidden files?

The correct answer is A. ls -a. The ls command's -a flag lists all files including hidden ones (those whose names begin with a dot). No other listed option correctly performs this function.

Finding Your Way on a Linux System

Question

Which of the following commands will display a list all files in the current directory including the hidden files?

Options

  • Als -a
  • Bls --hidden
  • Cls -h
  • Dls --a

How the community answered

(21 responses)
  • A
    71% (15)
  • B
    5% (1)
  • C
    14% (3)
  • D
    10% (2)

Why each option

The ls command's -a flag lists all files including hidden ones (those whose names begin with a dot). No other listed option correctly performs this function.

Als -aCorrect

The -a (or --all) flag for ls instructs it to not ignore entries starting with a dot, which is the convention Linux uses for hidden files. This reveals files like .bashrc and .profile that are otherwise omitted from directory listings.

Bls --hidden

ls --hidden is not a valid option for the ls command and will return an error; the correct long form is --all.

Cls -h

ls -h enables human-readable file size output (e.g., KB, MB) and has no effect on displaying hidden files.

Dls --a

ls --a is not a valid option and will produce an error; the correct short flag is -a and the correct long option is --all.

Concept tested: Listing hidden files using ls command flags

Source: https://man7.org/linux/man-pages/man1/ls.1.html

Topics

#ls command#hidden files#directory listing

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice