Skip to content

Linux rm command for removing files in directories

ArticleLinuxCommand LineDebianTerminal

Delete files from a directory:

rm [options..] [file|directory]

-f

Remove all files in a directory without prompting the user.

-i

Interactive. With this option, rm prompts for confirmation before removing any files.

-r (or) -R

Recursively remove directories and subdirectories in the argument list. The directory will be emptied of files and removed. The user is normally prompted for removal of any write-protected files which the directory contains.

Examples:

Terminal window
sudo rm -rf /media/Data/.Trash-1000/files
Terminal window
sudo rm -rf /home/.Trash-0/info