rm (short for remove) is a Unix command used to delete files from a filesystem. Unix (officially trademarked as UNIX, sometimes also written as Unix with Small caps) is a computer In Computing, a file system (often also written as filesystem) is a method for storing and organizing Computer files and the data they contain to make
Common options that rm accepts include:
rm is often aliased to "rm -i" so as to avoid accidental deletion of files. In computing alias is a command in various Command line interpreters ( shells) such as Unix shells 4DOS / 4NT and Windows 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 a superuser, would cause the contents of every writable mounted filesystem on the computer to be deleted. On many computer Operating systems the superuser, or root, is a special User account used for System administration.
rm is often used in conjunction with xargs to supply a list of files to delete:
xargs rm < filelist
When rm is used on a symbolic link, it deletes the link, but does not affect the target of the link. xargs (pronounced zargs is a command of Unix and most Unix-like Operating systems It is useful when one wants to pass a large number of arguments to a command In Computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another
Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place). (Note that, confusingly for beginners, permissions on the file itself are irrelevant. )
To delete a directory (with
rm -r), one must delete all of its contents recursively. This requires that one must have write and execute permission to that directory (if it's not empty) and all non-empty subdirectories recursively (if there are any). This sometimes leads to an odd situation where a non-empty directory cannot be deleted because one doesn't have write permission to it and so cannot delete its contents; but if the same directory were empty, one would be able to delete it.
If a file resides in a directory with the sticky bit set, then deleting the file requires one to be the owner of the file. The sticky bit is an access-right flag that can be assigned to files and directories on Unix systems
Sun introduced "
rm -rf /" protection in to Solaris 10. Solaris is a Unix -based Operating system introduced by Sun Microsystems in 1992 as the successor to SunOS. Upon executing the command, the system now reports that the removal of / is not allowed.  GNU
rm refuses to execute
rm -rf / if the
--preserve-root option is given, which has been the default since version 6. GNU ( pronounced) is a computer Operating system composed entirely of Free software. 4 of GNU Core Utilities was released. The GNU Core Utilities or coreutils is a package of GNU Software containing many of the basic tools such as cat, Ls