nerdexam
LPI

010-150 · Question #8

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. Creating a new file with touch or a new subdirectory with mkdir both add new entries to the current directory, increasing its element count.

Exercise Leadership and Client Education

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

(27 responses)
  • A
    74% (20)
  • B
    15% (4)
  • C
    7% (2)
  • D
    4% (1)

Why each option

Creating a new file with touch or a new subdirectory with mkdir both add new entries to the current directory, increasing its element count.

Atouch newfileCorrect

touch newfile creates a new, empty regular file in the current directory if it does not already exist, adding one new directory entry and increasing the directory's element count.

Bcreate newfile

create is not a standard Linux command for file creation and will result in a 'command not found' error on most systems.

Cls newfile

ls newfile reads and displays metadata about the specified file but performs no write operations and does not modify directory contents.

Drmdir newdirectory

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

Emkdir newdirectoryCorrect

mkdir newdirectory creates a new subdirectory entry inside the current directory, directly increasing the number of elements the directory contains.

Concept tested: Commands that add entries to a directory

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

Topics

#touch command#mkdir command#directory elements#Linux CLI

Community Discussion

No community discussion yet for this question.

Full 010-150 Practice