Linux : File & Directory Management

In this post, I’m going to give some list of Linux commands, which is very useful file & directory management.

#List all files in a long listing format with detailed information

ls -al

#Shows the present working directory


#Create a directory

mkdir <NewDirectoryName>

#Remove/Delete a file

rm <fileName>

#Remove the directory and its contents recursively

rm -r <directoryName>

#Remove/delete a file forcefully without prompting for confirmation

rm -f <fileName>

#Forcefully remove/delete directory recursively

rm -rf <directoryName>

#Copy file1 contents into file2

cp file1 file2

#Copy source directory recursively to destination. If destination exists, copy source directory into destination, otherwise create destination with the contents of source directory.

cp -r sourceDirectory destination

#Rename or move file1 to file2. If file2 is an existing directory, move file1 into directory file2.

mv file1 file2

#Create symbolic link to linkName

ln -s /path/to/<fileName> <linkName>

#Create an empty file or update the access and modification times of file

touch <fileName>

#View the contents of the file

cat <fileName>

#Browse through a text file

less <fileName>

#Shows the first 10 lines of the file

head <fileName>

#Shows the last 10 lines of the file

tail <fileName>

#Shows the last 10 lines of the file and “follow” the file as it grows

tail -f <fileName>

To contribute :

” If you like Advance Computing and would like to contribute, you can  mail your article to “”. You will get credit as your name , email id, designation with article on this blog. “

Leave a Reply

Your email address will not be published. Required fields are marked *