Working with Directories

This section covers deleting directories, copying and moving files between directories, and moving directories. It also describes how to use pathnames to make your work with GNU/Linux easier.

rmdir: Deletes a Directory

The rmdir (remove directory) utility deletes a directory. You cannot delete the working directory or a directory that contains other than . and .. entries. If you need to delete a directory with files in it, first use rm to delete the files and then delete the directory. You do not have to delete the . and .. entries; rmdir removes them automatically. The following command deletes the directory that was created in Figure 4-5:

$ rmdir /home/alex/literature

The rm utility has a –r option (rm –r filename ...

Get A Practical Guide to Red Hat® Linux® 8 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.