In this tutorial we will learn on how to Create, Delete, Copy, and Move Files and Directories in Linux operating system. Before looking into these basic things, we first need to look into some basic things like what is file system and what is absolute and relative file system. Linux file system perform important roles in data management and in efficient data handling in the Linux Operating System.
The Linux file system tree is a hierarchical structure which resembles the branch of tree and is the fundamental component of Linux operating system. Root directory is the main directory and all the directories originates from this main directory. To create, delete, copy, and move files and directories in Linux, it is necessary to understand this hierarchy of file system.
Table of Contents
Root directory or / is the top level directory and in this main directory there are multiple sub directories like home directory which contains the subdirectories of different users. The var directory which contains the variables files like logs.

In order find in which directory we are currently working we can use a command:
pwd
This will print the working directory in which we are currently working. Here is the path of File present in the home directory of user /home/muhammad/File.txt.
When the user is log in, It is by default present in the home directory of the user. We are taking the case when we are logged in as the muhammad user.
How to Create a file and directory in Linux:
We can create files by using the command below:
touch File.txt
In order to make an new directory we use below command:
mkdir New_directory
This will create the new directory in the current directory.

How to copy a file and directory in Linux:
In order to copy the files from one directory to the other we can use the cp (copy) command.
cp [source] [destination]
cp File.txt New_directory/
The above command will work to copy the files from one directory to the other. In order to copy the entire directory and its content from one directory to the other we will need to use the -r flag with copy command. Here r stands for recursive.
cp -r New_directory ../ali/
This will copy the directory and its entire content to the destination directory.
How to move or rename a file and directory in Linux:
The copy command creates the copy of file or the directory and moves the file to the destination folder. It simply created the duplicate of the file and place in the destination directory and can consume more space. We can also move files in by using the below command:
mv File.txt New_directory/
This will move the file in that folder without creating the additional copy. Unlike the copy command we do not need the use the -r flag with the mv command as it understand this by itself:
We also use mv command to rename the file or the folder.
mv File.txt new_file.txt
This will rename the file name to new_file.txt. We can also use the same command to rename the directory.
How to delete the files and directories in Linux?
In order to delete the file we can use the below command:
rm file.txt
For the directory we need to add the -r flag which stands for recursive. -f flag stands for forcefully delete the directory.
rm -rf New_dirrectory
-r flag ensures that the directory is deleted along with the subdirectories and the files that were present in that directory.
Hope after reading this article you have got the basic understanding of how to use the basin commands to Create, Delete, Copy, and Move Files and Directories in Linux.