Deleting Files and Directories
Removing files and directories is another common task when using Linux and should be performed with care. Deleted files and directories are irrevocably lost. This is a great reason to always maintain backups of important files or directories.
Deleting Files with the rm Command
The rm (remove) command is used to delete files and directories. You delete files by including a single filename or several filenames on the command line, like so:
$ rm sentmailJune1998 sentmailJuly1998 sentmailAugust1998
Use wildcards to delete multiple files:
$ rm *1998
The rm command with the -r (recursive) can also be used to delete files within a specified directory. If you attempt to delete a directory without this option, the rm
Get Practical Linux 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.