Search⌘ K
AI Features

The rm Utility

Explore how to effectively use the rm utility in Bash to delete files and directories. Learn to specify paths, use glob patterns for multiple files, handle write-protected files, and use options like -f for forced deletion and -r for recursive directory removal.

We'll cover the following...

rm

The rm utility deletes files and directories. Specify the object to delete by its absolute or relative path. Here are examples of rm calls:

rm report.txt
rm ~/docs/reports/2019/report.txt

The first call deletes the report.txt file in the current directory. The second one deletes it in the ~/docs/reports/2019 path.

Removing files and directories

Run the commands discussed in this lesson in the terminal below.

Terminal 1
Terminal
Loading...

The rm ...