You need to use the mkdir command to create new folders or directories under Linux operating systems. A directory (also known as folder in MS-Windows/OS X) is nothing but a container for other directories and files.
mkdir command Syntax
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | mkdir |
Time | Less than a minute |
mkdir dirname
OR
mkdir dirname1 dirname2
OR
mkdir [option] dieNameHere
OR
mkdir -p dir1/dir2/dir3
Examples
Open a terminal and use the mkdir command to create empty directories. The following command would create a directory called foo:
$ mkdir foo
To list directories, enter:
$ ls
$ ls -l
The following command would create two directories within the current directory:
$ mkdir tom jerry
$ ls -l
The -p option allows you to create parent directories as needed (if parent do not already exits). For example, you can create the following directory structure:
$ mkdir -p ~/public_html/images/trip
Sample mkdir demo
See also
- See mkdir command man page for more information.
- See ls command man page for more information.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 9 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
I really love your concepts of .gif file, which first time anyone assumes, it is a video.
Hats off to You :)
And yes, thank you very much, Whenever I need to learn something regarding linux commands, I used to check from your website.
Thank You Very Much For That
You are welcome, and thanks for the kind comments!
Very Gooddd……….
Stop lying plss
sahi hai boss
Thanks, I can now finally create a directory in my VPS.
Thanks for share. this info was useful to me.
Can we find another way to create the nested directory in a single directory
details is great really help me with my course work