What command is used to create a new directory in Linux?

Prepare for the Linux Professional Institute Certification Level 1. Use flashcards and multiple choice questions, complete with hints and explanations. Enhance your understanding and get ready to ace the exam!

The command used to create a new directory in Linux is mkdir. This command stands for "make directory," and it is specifically designed to create one or more directories in the specified path. When you run mkdir followed by the directory name, the system allocates the necessary space and creates that directory in the filesystem.

For example, using the command mkdir new_directory will create a directory named "new_directory" in the current working directory. Additionally, mkdir has options that allow for creating parent directories as needed, enabling users to create entire directory structures in one command by using flags like -p.

The other commands serve different purposes: touch is primarily used to create empty files or update the timestamps of existing files; rmdir is used to remove empty directories; and dir is typically a command used in DOS and Windows command-line environments to list the contents of a directory, although it may also work in some Linux environments as an alias for ls. Understanding their distinct functionalities is essential for working effectively in a Linux environment.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy