Help! Terminal deleted everything from my desktop!

Discussion in 'Mac Basics and Help' started by fmp3, Apr 3, 2012.

  1. fmp3 macrumors newbie

    Jan 29, 2006
    So I was trying to do something in terminal and I ended up deleting a lot of files from my computer. It deleted everything from my desktop, everything in my document and download files, and reset a lot of the settings and preferences from my computer. My music and bookmarks were all spared.

    I was copy/pasting this:
    cd ~
    mkdir mctmp
    cd mctmp
    jar xf ~/Library/Application\ Support/minecraft/bin/minecraft.jar

    and this:
    jar uf ~/Library/Application\ Support/minecraft/bin/minecraft.jar ./
    cd ..
    rm -rf mctmp

    into terminal.

    I seriously need some help. Is there anyway I can recover the files that were lost?
  2. simsaladimbamba

    Nov 28, 2010
    Looked into your Trash yet? Do you have any kind of backup?

    Anyway, I am not proficient in Terminal, but I only see one "remove" command (rm), but due to the "-rf" parameters you might have deleted some important data.


    Maybe have a look at Advanced Search to find similar threads about that Minecraft mod, since it happened more often in the past few months:
  3. fmp3 thread starter macrumors newbie

    Jan 29, 2006
    Wow. You were right. Apparently I wasn't the only person who's had this problem. Well I have a backup of one folder, but it will be unfortunate if I cannot retrieve the other files.
  4. fmp3 thread starter macrumors newbie

    Jan 29, 2006
    You wouldn't happen to know where I can talk to someone who is proficient in terminal?
  5. Makosuke macrumors 603

    Aug 15, 2001
    The Cool Part of CA, USA
    That's kind of weird; those terminal commands seem pretty straightforward, and I don't see where any of the rm commands would delete anything other than what they're supposed to.

    The symptoms you're describing sound like you deleted almost the entire contents of your Home folder (except I'd expect that to delete your Music folder as well--not sure how you'd get Documents and Desktop, but spare that one... or for that matter how you'd lose some preferences but not your bookmarks--those should all be in the same place). Is your Documents folder empty, or gone completely?

    Which would happen if, for example, you had done "cd ~" followed by "rm -rf ./" (do NOT enter that pair of commands in the Terminal--they would do what you're trying to undo).

    Assuming you were just copying and pasting those exact commands, the only thing I can think of is if the "jar" command did something unexpected.

    To confirm whether things got deleted or just moved, you can try searching for a filename that you know was in your Documents folder and see if it's somewhere else on disk. If not, your best bet is restoring from a backup (which it sounds like you don't have--take this as a lesson and start). You could also download a copy of Data Rescue 3; if you're lucky it will find deleted files it can salvage, but I wouldn't get my hopes up, and the restoration process could be time consuming and messy.

    If your Home folder did get cleaned out, rather than moved restoring from a backup is your best bet.
  6. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Here's another suggestion: create a throwaway user.

    That is, create a user (non-admin) whose sole purpose is to be safely disposible. You don't care if its home folder gets deleted, or anything else bad happens to it. Then do all your Terminal experiments only with that user.

    Even I find this useful in some cases (I have a couple sacrificial users), and I've been doing shell commands for a very long time.

    And I agree with Makosuke: I don't see anything wrong with those Terminal commands, either.

    Where did you read them from? Post the URL, please.
    Did you actually copy and paste them, or was there something that was typed? Pasted all at once or one by one?
  7. hchung macrumors 6502a

    Oct 2, 2008
    Look at the size of "~/Library/Application\ Support/minecraft/bin/minecraft.jar"
    How big is it? If it's huge, that might contain all your data.

    Otherwise, I'd go with the disk rescue suggestion.

    Keep in mind, the more you use this drive, the more likely the files you had lost will be lost forever. Please use another boot drive of some sort to access the net and search for info, as you might be doing further damage to your recovery chances.

    If you can't afford disk rescue, you might have to go with something less fancy and more tedious like testdisk (
    (I think testdisk loses most of the file names if I recall correctly.)
  8. FinalDestinater macrumors newbie

    Jul 5, 2013
    Me Too!

    This happened to me too:mad: I was trying to install TMI so I typed it in Terminal and then BOOM:eek: everything was gone:( My games don't work and minecraft got deleted so I had to redownload it, but my music and bookmarks (also some pictures) were all spared. Please tell me how to fix it when you know:eek: Wished I had a WINDOWS!!!!!!
  9. Nameci, Jul 5, 2013
    Last edited: Jul 5, 2013

    Nameci macrumors 68000


    Oct 29, 2010
    The Philippines...
    It is not terminal's fault. It is your fault not knowing what you are doing. It does not matter even if it is windows or linux or whatever OS. As long as you know what you are doing then you are safe.

    The jar command might have done it for you.

    I don't know this commands and I am not a an of MineCraft. Totally waste of my time. I have better things to do than playing with it.

    Since you have more time playing, have more time reading from Java resources.

    "jar xf" is extracting files from .jar and jar -uf is updating it. But afterwards you rm so I guess it removes everything on whatever folder you are in.
    I most certain your files are still there, it is just archived by the jar command. If it is deleted, its on the trash. Or I might be wrong.
  10. FinalDestinater macrumors newbie

    Jul 5, 2013
    So what should I do then? Anyway to get my files back?
  11. Nameci macrumors 68000


    Oct 29, 2010
    The Philippines...
    You have a time machine backup?

    If you don't have your only choice if you have important files lost is data rescue software.
  12. FinalDestinater macrumors newbie

    Jul 5, 2013
    Ok Thanks a lot so sad I can't get my data back:( Ill NEVER use jar again or mine craft I SWEAR!
  13. Fishrrman macrumors G5


    Feb 20, 2009
    Confucius say:

    He that play with Terminal's fire,
    Should be prepared to get burned.

    If you didn't keep a proper backup (I ALWAYS recommend a fully-bootable backup created with either CarbonCopyCloner or SuperDuper), you may be, well, "up the creek"...
  14. Dalton63841 macrumors 65816


    Nov 27, 2010
    jar itself isn't to blame. This is far outside the norm... Just for further information, this is what those commands do:

    1. cd ~
    (go to home folder)

    2. mkdir mctmp
    (create folder called mctmp)

    3. cd mctmp
    (go into mctmp folder)

    4. jar xf ~/Library/Application\ Support/minecraft/bin/minecraft.jar
    (extract minecraft.jar into mctmp folder)

    5. rm META-INF/MOJANG_C.*
    (delete META-INF/MOJANG_C* from mctmp folder)

    6. jar uf ~/Library/Application\ Support/minecraft/bin/minecraft.jar ./
    (update minecraft.jar with the contents of the mctmp folder)

    7. cd ..
    (go to the parent directory of mctmp, which is the home folder)

    8. rm -rf mctmp
    (delete the mctmp folder)

    Oh and in Terminal, Trash is treated as a normal directory, so putting something in the Trash would be "mv file ~/.Trash/". The "rm" command is a permanent delete, skipping the Trash.
  15. ElectricSheep macrumors 6502


    Feb 18, 2004
    Wilmington, DE
    If one of the lines that you copied and pasted has a stray space in it, you could have easily nuked quite a number of files in your home directory.

    Truth be told, the 'rm' commands are not necessary for the given instructions. You can delete the data out of META_INF via the Finder once you have executed the jar -xf command, and you can use the finder to clean up the mctemp folder after you have used the jar -uf command.

    rm unlinks a file from the filesystem—it does not use a holding area like the Trash. If there are not other links to the file elsewhere, it is gone. Additionally, the parameters -rf cause rm to work recursively into all subdirectories (r), and causes it to remove files without prompting for confirmation (f).
  16. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Please post the URL where you got your Terminal commands from.

    As previously stated in this thread, the commands shown (which you've quoted) will not delete everything. Something else must have happened. If no one knows what the "something else" is, no one can help you fix it.

    Worse, no one can see whether the Terminal commands you used are correct or not, so other people may continue to make the same mistake. No one with knowledge of Terminal commands knows what to correct.


    I agree. Even if some of the commands failed, such as mkdir failing to make a directory, or cd failing to move into a directory, the posted commands simply won't do a mass delete. At least not as given. If some unknown typos are added into the mix, including stray spaces, then all bets are off. Accuracy is important.
  17. Dalton63841 macrumors 65816


    Nov 27, 2010
    That's what struck me as odd. As written, these commands would not cause this result under any circumstance. My first thought was a mistype, but the OP claims to have copy/pasted the commands.
  18. FinalDestinater macrumors newbie

    Jul 5, 2013
    Ok so this is the website:, I copy and pasted the thing correctly
  19. Silvereel macrumors 6502

    Jan 19, 2010
    Because Windows never has any problems, right? Especially when you start using the command line to do stuff you're not supposed to.
  20. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    I see only one thing that's potentially wrong with that article. It's where their styling makes it look like two separate commands:
    jar uf ~/Library/Application\ Support/minecraft/bin/minecraft.jar
    This would be wrong. It would also not work (error message). And it shouldn't delete anything.

    Other than that, there's nothing I see there that will do a mass delete, if used exactly as given.

    I also note that the instructions on the page say to type in the commands, rather than using copy/paste. This seems like a strategy readymade for mistakes.

    Maybe you weren't as accurate as you thought, or maybe there was something else wrong. It's impossible to say without seeing an actual transcript of what was done.

    It's not uncommon for people unaccustomed to command-lines to make mistakes. I see it regularly, even when I specifically give instructions to use copy and paste.

    For future reference, it's not necessary to run these two commands in Terminal:
    cd ..
    rm -rf mctmp
    Instead, one can do this in place of running those commands:
    1. Quit
    2. Use Finder to trash the mctmp folder.

Share This Page