nerdexam
LPI

010-100 · Question #78

Which of the following commands increases the number of elements in a directory? (Choose TWO answers)

The correct answer is A. touch newfile E. mkdir newdirectory. The commands 'touch' and 'mkdir' add new entries to a directory by creating a new file and a new subdirectory respectively. The other options either do not exist, list contents, or remove entries.

Finding Your Way on a Linux System

Question

Which of the following commands increases the number of elements in a directory? (Choose TWO answers)

Options

  • Atouch newfile
  • Bcreate newfile
  • Cls newfile
  • Drmdir newdirectory
  • Emkdir newdirectory

How the community answered

(40 responses)
  • A
    78% (31)
  • B
    15% (6)
  • C
    5% (2)
  • D
    3% (1)

Why each option

The commands 'touch' and 'mkdir' add new entries to a directory by creating a new file and a new subdirectory respectively. The other options either do not exist, list contents, or remove entries.

Atouch newfileCorrect

The 'touch' command creates a new empty file if it does not already exist, thereby adding one entry to the current directory and increasing the directory's element count.

Bcreate newfile

'create' is not a standard Linux shell command and will result in a 'command not found' error, producing no change to the directory.

Cls newfile

'ls' lists the contents of a directory or information about a file - it is a read-only operation that does not create or remove any directory entries.

Drmdir newdirectory

'rmdir' removes an existing empty directory, which decreases the number of elements in the parent directory rather than increasing it.

Emkdir newdirectoryCorrect

The 'mkdir' command creates a new subdirectory inside the current directory, which adds one entry to the parent directory and increases its element count.

Concept tested: Linux commands that create files and directories

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

Topics

#touch command#mkdir command#directory management#file creation

Community Discussion

No community discussion yet for this question.

Full 010-100 Practice