Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"sudo rm -rf /" on terminal didn't delete everything.

I'm using an iMac running High Sierra and was fooled by and ran the sudo rm -rf/ command on terminal and gave the password (please don't lecture me about the dangers of messing with terminal, already learnt my lesson), realized something was wrong, closed terminal, and reboot the system.

The thing is, it deleted almost every user app (such as office and adobe suites) installed, but it left system apps (such as safari, calculator, etc) and some other ones (such as spotify) running perfectly fine, and apparently no user file has been deleted, desktop files, trash bin, user library, everything appears to be there still, and the hd even shows the same amount of GB used and available as before, even after a few hours (I even managed to back up everything into an external drive already).

My question is, according to what I read and saw, it should be wiped out completely almost immediately, and it seems to be according to forums, that the command is unstoppable and irreversible, so, I'm wondering if its still deleting files I have not noticed, if the command is still running, or if there's a chance it simply stopped. I'm also wondering if I should reinstall Mac OS through recovery mode anyways, just to be sure?

It seems weird to me nothing has visibly changed (apart from the apps I could tell were deleted) even after a few hours, being aware of the "killer" nature of the command...

Posted on Jun 18, 2018 2:08 PM

Reply
Question marked as Best reply

Posted on Jun 18, 2018 2:19 PM

It didn't destroy the entire Mac because even sudo is no longer a high enough command level to remove system files. Not as long as System Integrity Protection is enabled.


Restore your Mac from backup, if you have one.

Similar questions

6 replies

Jun 18, 2018 3:00 PM in response to an____m

an____m wrote:


I don't have a TM backup, just a copy of my files in an external drive, what you're saying means there's no damage done besides the app that were uninstalled? does that mean can I just reinstall them and keep working on it as usual? or I should restore it anyways?


Restore. You're going to be chasing this for a while, if you try a piecemeal repair.


If you tossed that delete-everything command at macOS, then it won't have deleted the write-locked parts of the macOS system and core Apple-provided apps due to System Integrity Protection, but a wildcard root rm command will have deleted everything else, including added apps and /usr/local apps and files, and user data and directories and preferences and login keychains and the rest... Whatever the rm command got to before it was interrupted.


Then please get Time Machine configured and going, or some other scheduled backup tool.

Jun 18, 2018 7:27 PM in response to an____m

Your not the first to make that mistake.


It's always best to wait awhile before running terminal commands from online forums. Hopefully, someone will give a warning while you wait. You should do an internet search on the commands suggested.


When you quit the terminal session, the command goes with it.


I recommend you make a complete backup of your system. I'm cautious. In case a file isn't in your back, maybe it wasn't erases on you startup disk.


I suggest you get an external harddrive and backup your startup disk. You can then use recovery mode to reload macOS.

-1- command + r should work. power off. hold down command + r key. power on. wait to see icon.

-2- option + command + r should work. power off. hold down option + command + r key. power on. wait to see icon.


Apple's Time Machine

https://support.apple.com/en-us/HT201250


Carbon Copy Cloner will copy your startup drive to an external drive. You can boot from the external drive to verify that you have a good clone. When you upgrade your existing startup drive, you can at any time boot from your external drive and go back to your existing system.

http://www.bombich.com/software/ccc.html


SuperDuper is the wildly acclaimed program that makes recovery painless, because it makes creating a fully bootable backup painless. Its incredibly clear, friendly interface is understandable, easy to use, and SuperDuper's built-in scheduler makes it trivial to back up automatically. And it runs beautifully on both Intel and Power PC Macs!


Give SuperDuper a workout on your own system. Clone to your heart's content — for free. See what else is possible. When you're convinced that SuperDuper is a terrific solution — and a great value at $27.95 — you can register right from the application and start using its advanced features immediately!


http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.htm


----------------------------------------

I think you need to find a "better place" to read about unix.


Practical Guide to Linux Commands, Editors, and Shell Programming, A (2nd Edition) [Paperback] the book Don't be fooled by the name, the second addition includes Mac OS X.


Advanced Bash Script. premise: Examples for everything. I have revision 6.2.
tldp.org/LDP/abs/abs-guide.pdf


BASH Programming - Introduction HOW-TO
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html#toc14


Apple administrative commands
http://manuals.info.apple.com/en_US/IntroCommandLine_v10.6.pdf


Apple Shell Scripting Primer
https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/Shel lScripting/ShellScripting.pdf


Check you local library. Any book on Bash syntax will do. There will be minor differences but they will not be great.


Sometimes you can get a good deal on used books in Amazon.


Bash Cookbook, Carol Albing, JP Vossen & Cameron Newham (O'Reilly)


I know it's old, but I haven't seen an update. Look.


Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (O'Reilly)) the book


*A Practical Guide to UNIX(R) for Mac OS(R) X Users* (Paperback) the bookThis is for Tiger & written in 2005.
Learning the bash Shell, Cameron Newham (O'Reilly)


Bash Cookbook, Carol Albing, JP Vossen & Cameron Newham (O'Reilly)


for Bash syntax see Advanced Bash Script. I have revision 6.2.
tldp.org/LDP/abs/abs-guide.pdf


BASH Programming - Introduction HOW-TO
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html#toc14


Sometimes you can get a good deal on used book in Amazon. Third edition.
http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=013 1367366&x=0&y=00


I found the second addition of this at my local library. Any book on Bash syntax will do. There will be minor differences but they will not be great.

-------------------------------------

Jun 18, 2018 2:38 PM in response to an____m

Yes, you can just reinstall things. Mind you, this will be time consuming. There's no real "damage". That is, no attempt at installing hacks, backdoors or other malware. The command simply tries to remove every single file and folder on the drive. The only damage is a lot of things were removed, and now need to be replaced from backup, or reinstalled.


1. Make sure you have a backup of all personal data. I know you mentioned that, but make sure before proceeding.


2. There are some unprotected files installed by the OS, so I would first reinstall that.


3. It sounds like your admin account is still there, so you just need to put personal files back if anything had been removed from the Documents folder, or other files within your account.


4. Reinstall all removed apps (Office, Adobe, etc.) from their original source disks or purchased downloads.

"sudo rm -rf /" on terminal didn't delete everything.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.