To create a new directory in a Linux terminal, you can use the mkdir command. Here’s how to do it step-by-step:
Steps to Create a New Directory:
-
Open Terminal: Access your terminal application.
-
Use the
mkdirCommand: Type the following command to create a new directory:mkdir directory_nameReplace
directory_namewith the desired name for your new directory.
Example:
If you want to create a directory named my_folder, you would run:
mkdir my_folder
Creating a Directory in a Specific Location:
If you want to create a directory in a specific path (e.g., in your home directory), you can specify the full path:
mkdir /home/your_username/my_folder
Replace your_username with your actual username.
Creating Parent Directories:
If you want to create a directory along with its parent directories (if they don’t exist), use the -p option:
mkdir -p /home/your_username/new_folder/sub_folder
This command will create new_folder and sub_folder if they do not already exist.
Verify Creation:
After creating the directory, you can verify it by listing the contents of the parent directory:
ls
This will show you the newly created directory in the list.
If you have any further questions or need assistance with a specific scenario, feel free to ask!
