What is the command for creating a new directory in Linux?

Prepare for the LPIC-2 Certification Test with our study tools, including flashcards and multiple choice questions with hints and explanations. Get ready to pass your exam!

The command used for creating a new directory in Linux is "mkdir." This command stands for "make directory," and it is a standard command available in most Unix-like operating systems. When you run "mkdir" followed by the desired directory name, it creates a new directory at the specified location.

For instance, if you want to create a directory named "projects," you would use the command:


mkdir projects

This command can also handle creating nested directories using the -p option, enabling you to create parent directories along with child directories in one command. For example:


mkdir -p parent/child

This would create both "parent" and "child" directories if "parent" does not already exist.

The other options such as "touch," "newdir," and "dircreate" do not serve the purpose of creating directories. "touch" is primarily used for creating empty files or updating the timestamps of existing files, while "newdir" and "dircreate" are not standard Linux commands and would not be recognized in most environments.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy