The rm command
The rm command deletes files. The syntax is as follows:
rm [options] file
The options are described in the following paragraphs:
- -f: Removes files that will be overwritten.
- -i: Interactively prompts for each file to be overwritten.
- -R: Copies the contents of subdirectories recursively.
To delete a single file, use it like this:
$ rm any.old.file
To delete multiple files, use a wildcard:
$ rm any.*
To delete an entire directory, use the -r switch:
$ rm -r /doug/old.files
In this tutorial:
- Linux Commands
- Command Shell Basics
- Editing commands
- Wildcards
- Redirection and piping
- Environment variables
- Shell scripts
- Directory and File Handling Commands
- The cd command
- The mkdir command
- The rmdir command
- The ls command
- The cp command
- The rm command
- The mv command
- The touch command
- The cat command
- Commands for Working with Packages and Services
- The rpm command
- Commands for Administering Users
- The usermod command
- The chage command
- The passwd command
- The newusers command
- The groupadd command
- The groupdel command
- Commands for Managing Ownership and Permissions
- The chgrp command
- The chmod command
- Networking Commands
- The ipconfig command
- The netstat command
- The ping command
- The route command
- The traceroute command