Warning:
To avoid catastrophic data loss, readers should NOT run this, nor any variations on it!
I would like to understand what does this command do: sudo rm -rf/*
Warning:
To avoid catastrophic data loss, readers should NOT run this, nor any variations on it!
I would like to understand what does this command do: sudo rm -rf/*
rm
= remove files-r
= recursive-f
= force (ie. don't ask for confirmation)-rf
to save typing./*
= files to start removing; ie. start in / or root directorysudo
elevates privileges - so the user will have write permission to everything.In summary, that command will delete every single file on your system without any sort of confirmation.
You can run man rm
to read the manual page for rm
.
As presented, the command will give an error because of a typo.
sudo rm -rf/*
[sudo] password for ___:
rm: invalid option -- '/'
Try 'rm --help' for more information.
Without the typo, the command would attempt to delete all files on the system. It would throw errors for some files, which are inherently undeletable, such as some contained in /proc
, /sys
, /dev
, or read-only file systems.
Although someone else has already indicated in comments how to correct it, I will not do so in this answer because it might cause some newbies to destroy their systems.
For more information about the rm
command, see man rm
.
sudo
elevates privileges. you canman rm
to read the manual page for rm – guiverc Jun 24 '19 at 10:59-rf
and/*
. – Arronical Jun 24 '19 at 11:31man sudo
andman rm
– glenn jackman Jun 24 '19 at 11:38rm -rf
a lot of their binary storage locations, they wouldn't have done it if they'd known what the command did. – Arronical Jun 24 '19 at 11:52