Removing Files with the rm Command

If you used the touch command and now have a file that you do not want on your Unix system, you may want to get rid of it. In this next section, we will learn how to remove files from your Unix system.

The rm command is used to delete unwanted files on your Unix system. Remember that using this command can get you into some trouble if you don't use it properly—you could remove data from your system that you do not want to remove. Unix takes what you say very literally, so be careful—you are not in a Microsoft Windows environment that checks you every step of the way when you delete a file. If you want to remove a file from your Unix system, follow these steps to use the rm command:

1.
Determine which file, ...

Get SAMS Teach Yourself Unix in 10 Minutes 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.