Search notes:

Shell command: rm

rm removes (aka unlinks) files or directories (-r needs to be specified for the latter).

Options

-f --force ignore nonexistent files and arguments, never prompt
-i prompt before every removal
-I prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes
--interactive [=WHEN] prompt according to WHEN: never, once (-I) or always (-i). Without WHEN: prompt always
--one-file-system when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument
­ --no-preserve-root do not treat / specially
--preserve-root [=all] do not remove / (default). With all: reject any command line argument on a separate device from its parent
-r, -R --recursive remove directories and their contents recursively
-d --dir remove empty directories
-v --verbose explain what is being done
--help

Removing files with special, cryptic or strange characters

Determine inode number of file with -i option of ls:
$ ls -li
Then use the -inum option of find. Since the file is in the current directory, -maxdepth can be set to 1:
$ find -maxdepth 1 -inum FOUND-INUM -exec rm {} +

Removing sensitive data

Because rm only removes the connection of a filename from an inode and the file's data is marked as free for the filesystem, it's relatively simple to undelete or recover the deleted data until the data is overwritten. Therefore, rm cannot be considered safe to delete sensitive data.
A somewhat more secure way to erase sensitive data is to use the shred command - however, this is not necessarily true anymore on solid state disks (SSD), see the stackexchange question Is shred bad for erasing SSDs?.

Misc

Contrary to an assertion in a tweet, the following command does not remove the french language pack :)
$ sudo rm -fr ./*

See also

Shell commands

Index