HELP! TERMINAL! ran a command that now force deletes files, skipping trash,CANT UNDO!

Discussion in 'macOS' started by jsfullr, Jul 14, 2009.

  1. jsfullr macrumors newbie

    Jul 14, 2009
    so i had needed to force delete a file on my computer that wasnt wanting to be deleted, and so i stupidly ran this command in terminal (thinking it would just force delete the entire trash)

    sudo rm -rf ~/.Trash

    however afterwards, every time i wanted to delete a file from my computer, it just skips the trash entirely, giving me a pop up message that says, "blahblah" will be deleted immediately, are you sure you want to continue?

    heres the site where i got the command from:

    please help, thanks
  2. gr8tfly macrumors 603


    Oct 29, 2006
    ~119W 34N
    The command did delete the trash - but also deleted the .Trash folder it resided in.

    Try (if you haven't already) the suggestions on that page under "Files dragged to the Trash "will be deleted immediately" alert"

    Removing the .Trash folder should have caused the Finder to recreate it. To avoid the issue entirely, I'd suggest simply going into the .Trash folder and removing the specific offending file manually - leaving the folder intact.
  3. jc1350 macrumors 6502a

    Feb 4, 2008
    Try this:

    open terminal and type the following line:

    mkdir ~/.Trash

    then type the following on the command line:

    chmod 700 ~/.Trash

    then type the following command:

    ls -ld ~/.Trash and the result should look similar to:

    drwx------ 2 your-user-name your-group-name 68 Jul 13 08:28 .Trash

    where 'your-group-name' will most likely match the user name. You are mainly checking for the permissions (1st column) and the directory name (last column) to make sure you didn't make any mistakes.

    The chmod (short for 'change mode') command sets the permissions so that only your account can read, write, and enter (execute) that directory.
  4. mslide macrumors 6502a

    Sep 17, 2007
    While what you did is not that big a deal, next time you probably want the following command instead...

    sudo rm -rf ~/.Trash/*
    This will delete everything inside the trash folder without actually deleting the folder itself.

    I'm surprised OSX doesn't just recreate the .Trash folder automatically (does it?), when you try to delete something or login or something.

Share This Page