I was just thinking about the

rm -rf *

command. The rm command removes any files following it, the -rf bit indicates to extend the rm command to include directories, and * means everything.

So, I thought about what would happen If I did:

rm -rf *

Could this ruin a computer? I'm not very well versed with what everything in the root directory does, but it seems like a lot of it essentially runs the computer.

So what would happen if I did this? How bad would it be? Could it break a computer?


As an interesting additional point, are there any commands as basic as this that can be done in the terminal which would be very damaging?

  • 1
    Set up a virtual machine with the Unix of your choice and try it in there. There is no better way of learning than by doing (other than possibly by teaching).
    – Kusalananda
    Apr 11, 2018 at 19:16
  • Furthermore, if you were to do this in the root directory and append --no-preserve-root it would be more devastating. But would it impact your usability of hardware? Possibly, on UEFI machines! Read: thenextweb.com/insider/2016/02/01/…
    – EDubman
    Apr 11, 2018 at 22:58
  • As for any commands as basic that you asked, have you tried typing :(){:|:&};: this at terminal. Apr 12, 2018 at 4:02

2 Answers 2


If you ran the sequence of commands:

rm -rf *

All non-hidden files and directories in your home directory will be deleted. Any contents of any userfs-mounted partitions (networked or otherwise) will be deleted. You may or may not be a very sad panda.

Would "this break the computer"? No. Would it cause you to lose any of your files, personally installed applications, desktop configurations, et cetera? Definitely.

If you did this (with superuser permissions) in the root directory, the results would be catastrophic. Any (non-hidden) files in the root directory, and the contents of all (non-hidden) directories in the entire filesystem would be deleted. Again, this includes the contents of any remotely mounted media (such as that NAS mount in /mnt/media to your collection of TV shows and movies, for instance).

Again - would this "break the computer"? No. Would it render it unusable until a new operating system is installed? Almost definitely unless another (unmounted) bootable partition exists. If you are unfortunate enough to have /boot mounted read-write after boot-time, there may be ramifications reaching to the bootability of other operating systems also.

Don't do this. Even on a VM.

  • 1
    VMs are easily rolled back. The files on the host system which are mounted in a share are not.
    – DopeGhoti
    Apr 11, 2018 at 22:35
  • Whether VM's are easily rolled back depends quite a lot on the virtualisation solution used. Apr 12, 2018 at 17:40

There's a difference between what you ask in the topic (running rm -rf * in the root directory) and what you ask in the question itself (doing it in your home directory), but the answer is the same: Don't do it.

A note on terminology: "ruin a computer" means different things to different people, I've previously f*cked my own desktop in a way so that I needed to press a key and select the right disc to boot from, I was fine with it, my mother would have considered that ruined.

The command would recursively delete everything (except hidden files/direcories), across mounts.

If from your home directory you "only" lose your own data, configuration, etc. and whatever is mounted as a subdirectory (not neccessarily directly) of your home directory (I don't know what "modern" systems/desktop environments do), on my desktop that would often include (parts of) my NAS holding my collection of movies/TV shows et al.

If from the root directory (with proper permissions, if done as an ordinary user, this would in most cases be comparable to if done from your home directory) you would lose everything (see anecdote below), and in this case you would be sure any mount was below, so you would delete everything on any mount.

15 or so years ago I actually tried doing rm -fr * from / as root, on a machine I wanted to reinstall anyway, for some reason the process died part way through the process (so it hadn't deleted everything), but it had deleted enough that the installation couldn't be rescued, and there wasn't any good way of finding out what had happened causing it stop deleting stuff.

I repeat the point: Don't do this!

  • "for some reason the process died part way through the process" I've always wondered if the command would ever actually complete. I always figured not. Who knows why it actually stops, but I just don't see how it could possibly complete. How is bash running if its binary doesn't exist? Your entire OS is gone.
    – Cruncher
    Feb 12, 2020 at 14:55
  • bash (or whatever shell you're using) would be in RAM, in that case it shouldn't matter what is on disc. Feb 12, 2020 at 15:29
  • On some systems, rm -r operates by recursively starting itself as a child process in each directory it encounters. As /bin is high up in the sorted glob of /*, the recursion dies shortly after /bin/rm is deleted, and only /bin/* is lost. Best not to try, though. We broke this on a Sun-3, and there was some kind of sysadmin busybox built into the console boot system which was enough to cd, ls and tar our way out of trouble. May 15 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.