
Linux Command Line
The ‘mkdir’ command in Linux is a simple yet powerful tool that allows users to create directories or folders in the file system. It is a command-line utility that is commonly used in both personal and professional settings, and can be executed in a variety of ways depending on the user’s needs.
When to use ‘mkdir’:
- When you want to create a new directory to store files or other directories
- When you need to organize your files and directories in a hierarchical manner
- When you need to create multiple directories at once
How to use ‘mkdir’: The basic syntax of the ‘mkdir’ command is as follows:
mkdir [options] directory_name
Here are some examples of how to use ‘mkdir’:
- To create a new directory called “documents” in the current directory:
mkdir documents
- To create multiple directories at once, you can use the -p option:
mkdir -p documents/work/projects
This command creates the “documents” directory, then the “work” directory within it, and finally the “projects” directory within the “work” directory.
- To create a directory with a specific mode, use the -m option followed by the mode in octal:
mkdir -m 755 documents
This command creates the “documents” directory with read, write, and execute permissions for the owner, and read and execute permissions for others.
The ‘mkdir’ command is a fundamental tool for managing files and directories in Linux. It allows users to easily create new directories, organize their file system, and even create multiple directories at once. By understanding the options and examples provided above, you will be able to master this command and use it to its full potential.
See our list of 75 Linux commands you should know about.