rm | |
---|---|
![]() The rm command | |
Original author(s) | Ken Thompson, Dennis Ritchie (AT&T Bell Laboratories) |
Developer(s) | Various open-source and commercial developers |
Initial release | November 3, 1971 |
Written in | C |
Operating system | Unix, Unix-like, V, Plan 9, Inferno, KolibriOS, IBM i |
Platform | Cross-platform |
Type | Command |
License | coreutils: GPLv3+ Plan 9: MIT License |
rm
, short for remove, is a shell command for removing files (which includes special files such as directories) from the file system. The command may not actually delete a file (release its storage for reuse) since it only unlinks it – removes a hard link to a file via the unlink()
system call. If a file has multiple links and less than all are removed, then the file remains in the file system; accessible via its other links. When a file's only link is removed, then the file is deleted – releasing its storage space for other use.
Generally, a deleted file's former storage space still contains the file's data until it is overwritten with another file's content. The data is not accessible via normal file operations but can be recovered via specialized tools. Since this is considered a security risk in some contexts, a hardened version of cp
may wipe the file's storage area when the file is deleted. Commands such as shred and srm specifically provide data wiping.
Since rm
does not provide a fallback to recover a file such as a recycle bin, its use involves the risk of accidentally losing information.[1] Users tend to wrap calls to rm
in safety mechanisms to limit accidental deletion. There are undelete utilities that attempts to reconstruct the index and can bring the file back if its storage was not reused.
Originally, developed for Unix, today it is also available on Unix-like and non Unix-like systems, KolibriOS,[2] IBM i,[3] EFI shell.[4] and Windows (via UnxUtils).[5] The del
command provides a similar capability in MS-DOS, OS/2, and Command Prompt.
Like rm
, the unlink
command also removes (unlinks) files, but only one file at a time.
© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search