written by: Kristen Grubb•edited by: Lamar Stonecypher•updated: 9/2/2009
One of the first questions Windows users have when they try out Linux is how to create folders. In Linux (and all the other 'nixes), folders are actually called directories and there are two ways to create new ones.
slide 1 of 3
Create Directories from the GUI
The two main Linux desktops, GNOME and KDE, try to make the transition from Windows to Linux as easy as possible. They allow you to create directories directly from the desktop. If you want to create a new directory on the Desktop, you can simply right click anywhere on the desktop and choose Create New Folder, much the same way you would in Windows.
If you want to place a new folder somewhere other than the Desktop, you will do so through the File Browser. The GNOME file browser is called Nautilus and the KDE file browser is called Konqueror. To open the file browser in Ubuntu, click on Places on the top toolbar, and choose Home Folder. The home folder is where you will hold all of your personal files. This is much different than Windows where you place documents, photos, etc. in the My Documents Folder and the configuration files in many different places. Once you open the Home Folder, you can click on Create New Folder under the File Menu or press CTL+Shift+N to create a new folder where ever you want.
slide 2 of 3
The mkdir Command
To create new directories from the command line, you will use the mkdir command. When you open a terminal window, you will find yourself in your home directory. You can check this by typing pwd which stands for "print working directory." You can list the current files in your home directory, by typing ls. Your new directory must have a different name than the existing directories, so it is a good idea to know what is already there.
To create a single directory, you will type the command mkdir new_directory. This will create a new directory with the name new_directory. If you want to create more than one directory, you can list each one after the mkdir command. For example, the command mkdir dir1 dir2 dir3 will create the directories dir1, dir2, and dir3. If you want to create a new directory within a different existing directory, you must specify the exact path to the new directory. For example, the command mkdir Pictures/new_pics issued from the home directory will create a new_pics sub directory in the Pictures directory.
The mkdir command will fail if the parent directory specified does not exist. In the example above, the command will fail if the Pictures directory does not exist. However, you can use the -p option to create the parent directories. So if the Pictures directory does not exist, you can type mkdir -p Pictures/new_pics/ to create both directories with one command.