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 ...

Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.