Removing files with rm

You can easily—perhaps too easily—remove (delete) files from your UNIX system. As Murphy will tell you, it's a good idea to think twice before doing this; once you remove a file, it's gone (unless, of course, you plead with your system administrator to restore it from a backup tape—but that's another story...). At any rate, it's permanent, unlike deletions in Windows 98 or the Macintosh OS, where the Recycle Bin or Trash Can give you a second chance.

You remove files using rm, as shown in Code Listing 2.9. And, as you'll see in the following steps, you can remove files one at a time or several at a time.

To remove a file:

1.
ls -l
List the files in the current folder to verify the name of the file you want to remove.

Get Unix: Visual QuickStart Guide 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.