Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Rm (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Permissions === On most file systems, removing a file requires write and execute permissions on the containing directory. Some may be confused that permissions on the file to be removed are irrelevant. However, the GNU implementation confirms removing a write-protected file unless the -f option is used.<ref>{{Cite news|url=https://www.theinquirer.net/inquirer/news/2454743/man-destroys-his-entire-company-with-a-five-character-bash-command|archive-url=https://web.archive.org/web/20160416214235/http://www.theinquirer.net/inquirer/news/2454743/man-destroys-his-entire-company-with-a-five-character-bash-command|url-status=unfit|archive-date=April 16, 2016|title=Linux rm command help and examples|date=24 January 2018|work=ComputerHope|access-date=24 January 2019}}</ref> To remove a directory (using <code>-r</code>), its contents must be removed, recursively. This requires the user to have read, write and execute permissions to the directory (if it's not empty) and any non-empty subdirectories recursively. Read permission is needed to list the contents of the directory. This sometimes leads to an odd situation where a non-empty directory cannot be removed because the user doesn't have write permission to it and so cannot remove its contents, but if the same directory were empty, the user would be able to remove it.<ref>{{Cite news|url=https://www.macworld.com/article/2082021/master-the-command-line-deleting-files-and-folders.html|title=Master the command line: Deleting files and folders|last=McElhearn|first=Kirk|date=2 January 2014|work=Macworld|access-date=24 January 2019}}</ref> If a file resides in a directory with the [[sticky bit]] set, then removing the file requires the user to own the file.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)