O'Reilly logo

Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition by 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 Directory with rmdir

To delete an empty directory named directoryname, use the following command:

matthew@seymour:~$ rmdir directoryname

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

matthew@seymour:~$ rmdir music/directoryname

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

matthew@seymour:~$ rmdir /home/matthew/music/directoryname

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

matthew@seymour:~$ rmdir ~/music/directoryname

The directory must be empty to be removed using rmdir. However, there is a way to remove a directory with its contents using rm

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