Difference between revisions of "Rm (command)"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
[[wikipedia:rm (Unix)]] included in <code>[[coreutils]] package</code> is used to remove different type objects such as computer [[files]], [[directories]] and [[symbolic links]] from file systems and also [[special files]] such as [[device nodes]], [[pipes]] and [[sockets]]. | [[wikipedia:rm (Unix)]] included in <code>[[coreutils]] package</code> is used to remove different type objects such as computer [[files]], [[directories]] and [[symbolic links]] from file systems and also [[special files]] such as [[device nodes]], [[pipes]] and [[sockets]]. | ||
− | The rm command removes references to objects from the filesystem using the <code>[[unlink]]</code> [[system call]]. | + | The <code>rm</code> command removes references to objects from the filesystem using the <code>[[unlink]]</code> [[system call]]. |
Man page: https://man7.org/linux/man-pages/man1/rm.1.html | Man page: https://man7.org/linux/man-pages/man1/rm.1.html |
Revision as of 05:52, 26 July 2022
wikipedia:rm (Unix) included in coreutils package
is used to remove different type objects such as computer files, directories and symbolic links from file systems and also special files such as device nodes, pipes and sockets.
The rm
command removes references to objects from the filesystem using the unlink
system call.
Man page: https://man7.org/linux/man-pages/man1/rm.1.html
Contents
Examples
rm /path/to/your/file
rm -rf
echo "" > /path/to/the/file.log
If it was already deleted, on Linux, you can still truncate it by doing: echo "" > "/proc/$pid/fd/$fd"
rm: cannot remove 'XXXX': Read-only file system
Related terms
find /path/to/directory/ -mindepth 1 -mtime +5 -delete
truncate
lsof -a +L1 /path/to/fs
- Files open but deleted:
lsof -nP | grep deleted
- Set file to zero:
truncate -s 0 /path/to/filename
unlink
echo
inode
touch
scrub
shred
mtime
- coreutils
- block
- virsh undefine
- vgremove
Activities
- Read about rm performance
- Read about ZFS
rm
"expensive" operations: https://serverfault.com/a/801080 - https://unix.stackexchange.com/questions/tagged/rm?tab=Votes
See also
Advertising: