To create a new directory (folder) in Linux, you use the mkdir command, which stands for "make directory."
Here is how you can do it:
1. Basic Usage
To create a directory in your current folder, type mkdir followed by the name you want to give it:
mkdir my_new_folder
2. Verify it was created
After running the command, you can use ls to see your new directory:
ls
3. Create a directory inside another path
You can also specify a path. For example, to create a folder inside /tmp:
mkdir /tmp/test_folder
4. Create multiple nested directories
If you want to create a folder inside a folder that doesn't exist yet (like projects/2024/january), use the -p (parents) flag:
mkdir -p projects/2024/january
This tells Linux to create all the "parent" folders if they are missing.
Try it out! You are currently in the /home/labex/project directory. Try creating a folder called practice and then use ls to see it.