Linux Mint

How to Create Files and Folders in Linux Mint 21

Creating files and folders in any system are important as it helps in organizing the data and keeping your data safe if you are new on Linux Mint and do not know how to create file and folder, then don’t worry as this guide will explain the detail process of creating a file and a folder in Linux Mint 21.

Creating Files and Folder in Linux Mint 21

There are primarily two ways to create files and folders in Linux Mint 21 and those are:

Using Terminal

If you are good at using terminal commands then this method will be a piece of cake as there are simple commands that everyone can remember:

Creating a Folder on Linux Mint 21 through Terminal

To create a folder in Linux Mint 21, use the following syntax:

$ sudo mkdir <Folder_Name>

Here for your understanding, there is an example has been done for you:

$ sudo mkdir linuxhint

To check if the commanded directory is created use the ls command:

You can also create multiple folders using the above syntax by writing folder names like:

$ sudo mkdir myfolder1 myfolder2 myfolder3

To create a folder in any other folder just give the folder path with the folder name using the following syntax:

$ sudo mkdir -p <path>/<folder-Name>

Here for your understanding, there is an example has been done for you:

 $ sudo mkdir -p /home/Documents/myfolder5

Creating a File in Linux Mint 21 through Terminal

i: Using nano Editor – Files with any format can be created using nano editor in Linux Mint 21 using the following syntax:

$ sudo nano <file_Name.format>

Here for your understanding, there is an example has been done for you:

$ sudo nano myfile.txt

Once you have entered or edited the data in the file press ctrl x and save the file by hitting enter, nest to see if the file is created use the ls command:

ii: Using touch command: This is another command that can also be used to create files in Linux Mint, to use this command follow the syntax:

$ touch <File-Name.format>

Here for your understanding, there is an example has been done for you:

$ touch myfile3.txt

iii: Using Redirection Operators: If you want to create a file along with adding some data in it then use the following syntax:

$ echo “Data to be entered” >> <File_Name.format>

For example:

$ echo “Welcome to LinuxHint” >> myfile.txt

The above command will create a file “myfile.txt” if it is not present in the current working directory.

To create a file in any specified directory then just give the path to that directory along with the filename and its format:

$ sudo mkdir -p <directory path>/<File-Name.format>

Here for your understanding, there is an example has been done for you:

$ sudo mkdir -p /home/Documents/myfile.txt

Using GUI

Another way of creating files and folders on your Linux Mint 21 is by using its graphical user interface and this method is best for those who are not good with using terminal commands.

Creating Folders in Linux Mint 21 through GUI

If you want to create a folder on Linux Mint 21 using its GUI then follow the steps precisely:

Step 1: Click on the Files icon on the taskbar to open the home directory of your Linux Mint 21:

Step 2: Next right click and from the context menu select the option of Create New Folder:

Now you will see that the folder is created, next rename the folder according to your choice:

This way you can create a folder in Linux Mint 2.

Creating Files in Linux Mint 21 through GUI

Open the home directory just the way like we explained earlier and from the right click menu select the Create New Document and from there click on Empty Document:

Next rename the file along with the format according to your choice:

Once the file is created double click on it to edit it:

Conclusion

Linux Mint 21 is a Linux distribution that is widely used, but the main difficulty newbies face is in creating files and folders. There are two methods for creating files and folders in Linux Mint 21 one by using its terminal and the other is by using its GUI both are explained in this guide.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.