How to Remove Directory in Linux: 2 Step Process

Harinderpreet singh Last updated

Are you a Linux user or Recently Switch to Linux operating system and want to know how to delete files.

Well, there are many ways to Delete Files. Here in this, I will share simple steps to Remove any Directory (which is known as Folder in windows).

If you are Apple Mac user then you can also delete files using the same steps because Mac is made from Linux.

How to Remove Directory In Linux

1. one Open Terminal in that folder

2.

rm -r directoryname

That’s All You done

Here
rm:  This is Linux command stands For remove

-r: If you don’t use -r then you will face a warning bash: **** is Directory. For removing files (that are not directory like text files You should use rm only).

directoryname: This is the name and full path to your Directory. So How will you Find a directory path. When you open terminal your default location is /home/username/ (Type pwd in the terminal to View it)or if you log in as Root user then it will be /root

Suppose that directory You want to Remove is at Desktop with named of opentechinfo So your path will be

rm -r ./Desktop/opentechinfo

Here . means Current Directory

Here you can Learn More Linux commands

Other Tips

1. You can also rmdir directoryname which stands for remove directory 

2. Suppose you want to Remove All Files that start with open. (example open1 open2 opentechinfo)

So you can do rm open* It will delete all files that start with open (does not matter end with what

3. Type rm –help to View More option that you can use

4. Is there any Recycle Bin in Linux. Yes but this is known as Trash

 

Leave a Reply

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