Blog

Make a Mac Executable File via the Command Line to Quickly Clean Your Trash
Posted on May 31, 2014 in Command Line, Linux, Mac by Matt Jennings

The commands below may also work in Linux and Unix. Both the Mac OS and Linux are based on Unix.

  1. Open Terminal.
  2. In Terminal cd Desktop and press Enter.
  3. nano clean-trash and press Enter. This will bring you to Nano, a Terminal application to edit files.
  4. Copy and post the code below into the next screen in Terminal that appears:
    rm -rfd ~/.Trash/*
    rm -rfd ~/.Trash/.*
    Killall Terminal
  5. Press Ctrl + x and Enter.
  6. Then you may need to press y or Enter to save the file exit Nano. You will return to the Terminal shell you were at before you went into Nano and will also be in the Desktop directory.
  7. chmod +x clean-trash and press Enter to make the file executable on your Desktop. Exit the Terminal.
  8. If everything worked correctly you will see a clean-trash file on your Desktop. When you click it, if there are files in your trash they will be all deleted, including hidden files like .htaccess.

Leave a Reply