pavement

Rm

From FreeBSDwiki
Revision as of 23:58, 26 January 2009 by 201.81.174.118 (Talk)
Jump to: navigation, search

Short for remove. Seriously, be careful when using this. There is no undelete once you've unlinked a file unless you've aliased rm to a mv script that moves files to a trash folder. This practice is not recommended because you will eventually find yourself on a system that doesn't have that alias and make a mistake. However, you can alias a different command to do this task by putting something like this in your startup file:

alias del "mv */! .trash"


About the -P argument

Use this argument with extreme care! If you use rm -P to remove a file that has hard links, the file will be immediately overwritten and its contents will be lost, thus not accessible via the links. For example :

$ echo 'Hello World' > foo
$ ln -h foo bar
$ cat foo bar
Hello World
Hello World
$ rm -P foo
$ cat bar
$ ls -la bar
ls: bar: No such file or directory

See also rmdir

Personal tools