Managing files and directories is a crucial aspect of any operating system, including Ubuntu. This involves creating, deleting, renaming, and moving files and directories. In Ubuntu, users can perform these tasks using the File Manager for a graphical interface or various command-line tools such as mkdir, rm, mv, and cp.
In this tutorial, we’ll present step-by-step instructions for creating a folder/directory in Ubuntu 24.04.
How to Create a Folder/Directory in Ubuntu 24.04?
We can create a folder in Ubuntu using the following methods:
- Method 1: Using File Manager | GUI
- Method 2: Using Terminal | CLI
- Bonus Tip: Remove a Folder in Ubuntu 24.04
Let’s start with the GUI method.
Method 1: Using File Manager | GUI
File Manager comes pre-installed in Ubuntu that is a GNOME-based utility. It is also known as “Files” or “Nautilus” in Ubuntu. It offers an easy-to-use interface for managing and accessing files and directories on our system.
Let’s follow the below procedure for creating a folder/directory on Ubuntu 24.04 via the File Manager:
Step 1: Open the File Manager
In Ubuntu 24.04, the File Manager icon is available on the left side of the screen, simply click on it to open, or search File Manager in the applications menu:
Step 2: Access the Desired Location
The following window pops up when we click on the Files or Files Manager icon:
Move to the desired location where you want to create a folder. For instance, we want to create a folder in the “Pictures” directory, so we navigate to that folder:
Step 3: Create a New Folder or Directory
Inside the target directory, hit the right-click in an empty area and pick “New Folder” from the context menu:
Alternatively, we can use the keyboard shortcut keys “SHIFT + CTRL + N” to do the same. In both cases, we’ll be asked to provide a valid name for the folder to be created. Specify the folder name of your choice and hit the “Create” button:
There you go! The desired folder has been successfully created at the selected location:
Note: If users don’t mention a folder/directory name, the folder is created with the default name “Untitled Folder”.
Method 2: Using Terminal | CLI
The terminal is a command-line interface in Ubuntu that enables users to perform various tasks by running different commands. We can create a folder/directory using the terminal. For this purpose, the mkdir command is used in Ubuntu.
For creating a folder in Ubuntu 24.04 via the terminal, follow the below-listed instructions:
Step 1: Open the Terminal
Launch the Ubuntu terminal by pressing “CTRL + ALT + T” or by locating it through the applications menu:
Step 2: Access the Desired Location
Let’s execute the cd command by mentioning the complete path of the folder where users need for creating a new folder. For instance, we use this command to access the “Music” folder:
cd Music
Step 3: Create a Single Folder
Now we can execute the mkdir command in the selected location to create a new folder/directory:
mkdir favSongs
This command creates a new folder named “favSongs” in the “Music” folder:
Note: Don’t put multiple spaces between folder names when using the mkdir command; otherwise, it may interpret the spaces as separating different folder names or arguments.
Step 4: Create a Multiple Folders
To create several folders using a single command, use the mkdir command with the space-separated syntax as follows:
mkdir folder1 folder2
Step 5: Confirm Folder Creation
We can verify the folder creation by listing all the files and directories within the Music folder:
ls
The output confirms the creation of the “favSongs”, “folder1”, and “folder2”.
Bonus Tip: Remove a Folder in Ubuntu 24.04
To remove a folder in Ubuntu 24.04, we can utilize the rmdir command as follows:
rmdir folder2
This command removes folder2 from the Music folder permanently.
Let’s verify that the folder2 removal using the ls command:
ls
That is all from the command line.
Remove Multiple Folders in Ubuntu 24.04
We can remove more than one folder using the same rmdir command as follows:
rmdir favSongs folder1
Similarly, we can delete a folder using the GUI method. For this purpose, right-click on the targeted folder and then click the “Move to Trash” option from the menu:
However, the GUI method removes a folder temporarily. To remove it permanently, either delete it from the Trash or click on the targeted folder and then press “SHIFT + DELETE” from your keyboard.
Conclusion
In Ubuntu 24.04, we can create a folder either through the File Manager or the Terminal. To use the File Manager or GUI method, go to the desired location, right-click in an empty area, choose “New Folder” from the context menu, and enter the name of the new folder. Alternatively, we can move to the target location with the cd command and then run the mkdir command from the Terminal to create a new directory. In this tutorial, we discussed both CLI and GUI methods to create a folder in Ubuntu 24.04. Additionally, we explained how to remove a folder/directory via the File Manager or Terminal.
Frequently Asked Questions
mkdir myfolder
This will create a folder named myfolder in the current directory.
mkdir /home/user/Documents/myfolder
Replace /home/user/Documents/ with the desired path.
mkdir "My Folder with Spaces"
mkdir folder1 folder2 folder3
mkdir -p parent/child/grandchild
This will create parent, child, and grandchild directories in one command.
Leave feedback about this