Rm (Unix)
From Wikipedia, the free encyclopedia
- The correct title of this article is rm (Unix). The initial letter is shown capitalized due to technical restrictions.
rm (short for remove) is a Unix command used to delete files from a filesystem. Common options that rm accepts include:
- -r, which removes directories, removing the contents recursively beforehand
- -i, which asks for every deletion to be confirmed
- -f, which ignores non-existent files and overrides any confirmation prompts ("force")
rm is often aliased to "rm -i" so as to avoid accidental deletion of files. If a user still wishes to delete a large number of files without confirmation, they can manually cancel out the -i argument by adding the -f option (as the option specified later on the expanded command line "rm -i -f" takes precedence).
rm -rf (variously, rm -rf /, rm -rf *, and others) is frequently used in jokes and anecdotes about Unix disasters. The rm -rf / variant of the command, if run by an administrator, would cause the contents of every writable mounted filesystem on the computer to be deleted. As said by Larry Wall in 1991, "Just don't create a file called -rf. :-)"
rm is often used in conjunction with xargs to supply a list of files to delete:
xargs rm <filelist
[edit] See also
[edit] External links
Unix command line programs and builtins (more) | |||
File and file system management: | cat | cd | chmod | chown | chgrp | cp | du | df | file | fsck | ln | ls | lsof | mkdir | mount | mv | pwd | rm | rmdir | split | touch | ||
Process management: | at | chroot | crontab | exit | kill | killall | nice | pgrep | pidof | pkill | ps | sleep | time | top | wait | watch | ||
User Management/Environment: | env | finger | id | mesg | passwd | su | sudo | uname | uptime | w | wall | who | whoami | write | ||
Text processing: | awk | comm | cut | ex | head | iconv | join | less | more | paste | sed | sort | tail | tr | uniq | wc | xargs | ||
Shell programming: | echo | expr | printf | unset | Printing: | lp |
Communications: inetd | netstat | ping | rlogin | traceroute |
Searching: find | grep | strings |
Miscellaneous: banner | bc | cal | man | size | yes |