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.
- Open Terminal.
- In Terminal
cd Desktopand pressEnter. nano clean-trashand pressEnter. This will bring you to Nano, a Terminal application to edit files.- Copy and post the code below into the next screen in Terminal that appears:
rm -rfd ~/.Trash/* rm -rfd ~/.Trash/.* Killall Terminal
- Press
Ctrl+xandEnter. - Then you may need to press
yorEnterto 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 theDesktopdirectory. chmod +x clean-trashand pressEnterto make the file executable on your Desktop. Exit the Terminal.- If everything worked correctly you will see a
clean-trashfile on your Desktop. When you click it, if there are files in your trash they will be all deleted, including hidden files like.htaccess.