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.
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)- A78% (31)
- B15% (6)
- C5% (2)
- D3% (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.
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.
'create' is not a standard Linux shell command and will result in a 'command not found' error, producing no change to the directory.
'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.
'rmdir' removes an existing empty directory, which decreases the number of elements in the parent directory rather than increasing it.
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
Community Discussion
No community discussion yet for this question.