What is the command to remove an empty directory?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command to remove an empty directory is "rmdir." This command is specifically designed to delete directories that do not contain any files or other directories. When using "rmdir," if the directory is not empty, the command will return an error, which ensures you do not accidentally delete valuable data or directories that are in use.

On the other hand, other options like "del," "rm," and "delete" do not serve the same specific purpose. "del" is not a standard command in Linux; it is commonly used in Windows environments for deleting files. The "rm" command can delete files and non-empty directories when used with the appropriate flags, such as "-r" for recursive deletion. Lastly, "delete" is not a valid command in Linux for that context. Therefore, "rmdir" is the most appropriate command to remove an empty directory.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy