Ubuntu delete directories or files command line


Helptipsweb

To delete all file in a directory

rm /path/to/directory/*

To remove the folder with all its contents(including all interior folders):

rm -rf /path/to/directory

To remove all the contents of the folder(including all interior folders) but not the folder itself:

rm -rf /path/to/directory/*

To remove all the “files” from inside a folder(not removing interior folders):

rm -f /path/to/directory/*

rm – stands for “remove”
-f – stands for “force” which is helpful when you don’t want to be asked/prompted if you want to remove an archive, for example.
-r – stands for “recursive” which means that you want to go recursively down every folder and remove everything.

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s