-1

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/*

Eliah Kagan
  • 119,640
Helen
  • 129

2 Answers2

8
  • rm = remove files
  • -r = recursive
  • -f = force (ie. don't ask for confirmation)
  • The options were grouped as -rf to save typing.
  • /* = files to start removing; ie. start in / or root directory
  • sudo 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.

guiverc
  • 33,561
7

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.

xiota
  • 5,038