Verbosely emptying the trash

Like it happens on Windows, when you decide to delete something OSX simply moves that file or directory to “the Trash”, which is just a hidden directory on the volume you’re deleting from. Then, you right click on the Trash icon and select “Empty trash”.
This action pops up a small window like this:

osx trash progress window

I grew tired of asking myself what OSX was deleting (the operation can take a while, especially when — as I often do — you’re doing a secure erase) so this ugly one-liner, run as root, will give you the file the OS is working on:


ps auxw | grep -i locum | grep -v grep | awk '{print $2}' | xargs lsof -p | grep -i Trash | awk '{print $9}'

It will output something like this:
/Volumes/FAT80GB/.Trashes/502/xcode3210a432.dmg

You can wrap that command inside the usual while/sleep loop if you want something that keeps you updated on what is going on — or make it an alias for your favourite shell.


No Responses to “Verbosely emptying the trash”  

  1. No Comments

Leave a Reply



Related Entries

www.flickr.com
This is a Flickr badge showing public photos from zen0. Make your own badge here.