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.
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)- A74% (20)
- B15% (4)
- C7% (2)
- D4% (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.
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.
create is not a standard Linux command for file creation and will result in a 'command not found' error on most systems.
ls newfile reads and displays metadata about the specified file but performs no write operations and does not modify directory contents.
rmdir newdirectory removes an existing empty directory, which decreases the number of elements in the parent directory rather than increasing it.
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
Community Discussion
No community discussion yet for this question.