O'Reilly logo

Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition by Paul Hudson, Andrew Hudson, Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deleting a File or Directory with rm

To delete a file named filename, use this command:

matthew@seymour:~$ rm filename

You can remove a directory in a different location by changing what is after rm. To remove a directory in /home/matthew/randomdirectory, if I am already in my /home directory, I can use the following:

matthew@seymour:~$ rm randomdirectory/filename

Or from anywhere using an absolute path, I can use this:

matthew@seymour:~$ rm /home/matthew/randomdirectory/filename

Or from anywhere using a path shortcut, I can use the following command:

matthew@seymour:~$ rm ~/randomdirectory/filename

If you try to use rm to remove ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required