Understanding the Trash Can in OS X

Understanding the Trash Can in OS X

Tutorial Details
  • Topics: File Management, Trash
  • Difficulty: Intermediate
  • Estimated Completion Time: 15 Minutes

Admittedly at first glance, an article on how to use and understand the Trash Can inside of OS X may seem a bit beneath even the most novice of newcomers. However, the Trash Can, and even deleting files in general, both work very differently in OS X than other operating systems. Even I was thrown for a loop or two when I made the jump to OS X. I hope this extensive rundown of the Trash Can will help you better understand and manage your files and storage space on your Mac.

How OS X Handles Deleted Files:

When you delete a file in OS X (that is, empty the Trash Can) the operating system is not actually erasing the data (unless you tell it to, more on that in a bit), but rather it is actually just marking the space that said file took up on the physical hard drive as free space to be written over with new data. This is pretty common file handling across most operating systems.

Each storage device that you plug into a Mac running OS X gets its own Trash Can specific to that device.

Where OS X gets unique with handling files set for deletion is with additional storage mediums such as external hard drives and USB thumb drives. Each storage device that you plug into a Mac running OS X gets its own Trash Can specific to that device. This is done with a hidden folder that is used for storing files on that drive that you have sent to the Trash Can.

trash can OS X
Hidden Trash Can Folder On USB Storage Device Containing The Files You’ve Moved To the Trash Can

The Trash Can icon in the OS X Dock is actually an aggregation of all the deleted files on all plugged in drives on your Mac. It is important to understand that no file is deleted until you empty the Trash Can. Until you do so, the files are in a hidden folder and still using disk space on your various storage devices.

But Why?

This may seem redundant at first but as it turns out this is a very intuitive way to handle files set to be deleted. A file on a portable USB thumb drive gets put into the Trash Can folder for that USB thumb drive, and stays there until you empty the Trash Can for it by emptying the Dock Trash Can with the device plugged in.

The files you send to the Trash Can will follow the portable device around until the Trash Can is emptied

This is good because the files you send to the Trash Can will follow the portable device around until the Trash Can is emptied. So if you decide that you needed a file you placed into the Trash Can on the Mac at your office, it is there inside the Trash Can on your Mac at home once you plug the USB drive in. No more trips back to the office or waiting until tomorrow to get work done.

Trashed Files Still Eat Up Space

Keep in mind that this means files sent to the Trash Can on an external drive are still using the disk space on that drive until the Trash Can is emptied. So if you have a full USB thumb drive and delete all the files, you do not actually recover the storage space on the drive until you empty the Trash Can with the drive plugged in.

A Big File/Folder Taking Up Space That you Want To Delete
A Big File/Folder Taking Up Space That you Want To Delete
Even After Being Sent To The Trash Can, The File Is Still Using disk Space
Even After Being Sent To The Trash Can, The File Is Still Using disk Space
Only After The Trash Is Emptied Do you Recover Storage Space
Only After The Trash Is Emptied Do you Recover Storage Space

I mentioned that, when you empty the Trash Can, for all intents and purposes the files are gone. However, the data on the physical drive is still there and could potentially be recovered using third party software. It has not been deleted but has been marked for reuse by OS X, and will eventually be written over with new data. If you are ever deleting sensitive data and wish to know that the data has been written over immediately upon emptying the Trash Can; you can do a Secure Empty Trash, which will immediately write the data over on the physical hard drive.

Keep in mind this process can take a few seconds or upwards of an hour depending on the size of the data files being deleted and written over and your hard drive write speed. Also bear in mind that if someone really wants to access the deleted files on your hard drive, say law enforcement, anything short of completely destroying the physical drive can be undone.

Command + Right Click On The Trash Can To Toggle Secure Empty Trash
Command + Right Click On The Trash Can To Toggle Secure Empty Trash

If emptying the trash seems to take too long, or you want to set Secure Empty Trash as the default behavior; with Finder active go to Finder > Preferences > Advanced Tab and check or un-check Empty Trash Securely.

Set The Default Behavior For Emptying The Trash In Finder
Set The Default Behavior For Emptying The Trash In Finder

Finally, when you have a disk in the CDROM drive, a .dmg file mounted (OS Xs way of installing apps) or an external storage device and wish to eject it; you can do so by clicking the correct icon and dragging it to the Trash Can icon, which will have turned into an Eject icon.

The Trash Can Turns Into An Eject Icon For CDs or External Storage Devices
The Trash Can Turns Into An Eject Icon For CDs or External Storage Devices

Conclusion

OS X is a truly advanced operating system, and because of this some things may work a little differently than at first expected. Once you have a good working understanding of how OS X handles deleted files however, you will see that it is not only a smart way to deal with them, but also a safe way that is sure to eventually save you from a headache. I hope this quick rundown of the Trash Can will help improve your OS X experience as well as help you to better manage and use your storage space when deleting files.

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Ashley Clarke

    By emptying the trash securely every time, does this provide any benefits to a smoother running machine??

    And nice article,

    Thanks

    • http://www.robertanthonyperez.com Robert Anthony
      Author

      Hi Ashley! Glad you liked the article. I don’t believe that there is any benefit performance wise from doing a secure empty trash. The only thing secure empty trash is doing is, instead of “making a note” that the space is free to be written over by the OS, it is going ahead and writing over the data and allocating it as free space.

  • Sakis

    Am I the only one who is annoyed by the fact that you can not delete a single file from the Trash? (At least that’s the situation with Snow Leopard. I don’t know if this has been added in the later versions of the OS X)

    • http://www.robertanthonyperez.com Robert Anthony
      Author

      Hi Sakis,

      I would agree that this would be a nice thing to be able to do, possibly with a modifier key combination. I just tried to see if I could delete an individual file on Mountain Lion to no avail. I have actually thought of this before when going through the files in the Trash Can after a round of mad dash working to make sure I didn’t accidentally delete a needed version of a file or the like.

      That said, I can understand why this is not an option. A bad habit I’ve seen a lot of computer users have is to use the trash can/recycle bin as a sort of file “limbo” or temporary storage. The Trash Can is not the best place to put files that you are unsure if they will be kept or deleted.

      I’m kind of torn, I kind of sort of think it would be nice, but I can see it getting me into trouble because what other use for the Trash Can is there than to put in files and delete them. One trash file should merit the same fate as the next, no?

  • verpixelt

    @Sakis why do u want to just delete a single file which is already thrown into the trash can? I dont get the case.
    @i guess it doesnt change anything except the fact the data u want to delete gets overwritten immediately

    • Sakis

      Well, here is a scenario that happens quite often:

      From time to time, i find myself having some files that will *probably* be deleted in the near future.

      But there are some files like .dmg files, or .zip files, that after i have either installed the app (in case of the .dmg) or extracted the files, they are no longer of use to me and i want to delete them.

      But i’m forced to either have them moved to trash and wait until i’m *certain* that the rest of the files should be deleted too, or open the terminal and rm them.

      Which also brings up the following irritating thing: Why is there no way of deleting a file without moving it to the Trash first? It could be done via a shortcut like shift+delete on windows…

      P.S. While writing this comment, i did search about these things on google, and i came up with this:
      http://superuser.com/questions/10676/permanently-deleting-files-on-mac-os

  • makebei

    Not being able to delete a single item from the trash can also drives me nuts. There are a few instances where I don’t want to delete everything. e.g. When I update a Mac app from the App Store or an iPhone app from within iTunes, the previous version of the app is sent to the Trash. I don’t necessarily want to delete these in case I ever want to revert back to a previous version of the app. Sure I can move the files that I want to keep somewhere else and then empty the trash can, but this is fairly tedious, especially when I have so many files that get deleted and apps that get updated on a regular basis.

    Another example is when I’m travelling and using a friend’s Mac. I plug my SD Card (which has all my photos from my trip) into their computer and delete all the blurry/bad photos. Then I go to the Trash and I just want to delete my photos. I don’t want to delete any of their files from the Trash.

    It just seems silly that I can’t do something as simple as delete a single file. To get around this issue, I either open up a Terminal window when I want to delete a file and type rm file_name or rm -rf folder_name for folders. If the files are already in the Trash then I move the files I want to keep to a folder somewhere on my computer and then just empty the Trash. However, these solutions aren’t ideal, I’d really just like the ability to delete individual files.

  • http://www.robertanthonyperez.com Robert Anthony

    Thanks for the input Makebei, valid points indeed! Having read yours and Sakis’ comments I can see how this feature would be usefull. Sorry to say I don’t have an answer or workaround to offer. If either of you happen to come across one please share it here if you remember!

    That said I still stand by what I’ve said about OS X handling deleting files in a more logical and intuitive way than other OSs (OS’?).

  • Thomas

    Let’s say a friend comes over to visit me. And let’s say that I want to share a nice photograph with him. He brings with him a USB drive, but unfortunately there isn’t enough space on the drive. We delete a document on his drive to be able to copy the file.

    For this to work I need to empty the trash can on my machine, including all deleted files from my own hard drive.

    This does not seem logical to me. There should definetly be a setting somewhere like “Keep local trash on external drives?” (yes or no)

  • Steven

    The way windows handles trash is substantially better.

    Computers have been aiming for the ideal desktop metaphor since the GUI was created, and OSX is *way* off.

    If I’m at work and I take a document out of my briefcase and throw it away, it does not show up in the trash can at my desk at home when I take my briefcase back home. It stays in the trash can it was placed in. Computers should follow the same principle.

    The problem is that OSX has many trash cans, but only shows you one. Each device you have plugged in adds a new trash can to the list, but the GUI shows they are one, and makes you manipulate them as one. Its a glaring inconsistency and should be fixed.

  • http://www.xn--danielnuez-09a.com Daniel N

    I dont really like the independent trash can for every external device, especially USB thumb drives. I always have to explain my friends the reason why their drives are still full after they have emptied them.

  • http://rasmusson.net Niklas Rasmusson

    Is “Secure empty trash” the same as “rm -rf path/to/file_or_folder”?

  • Zandra

    There are several apps that allow you to choose which files to delete from your Trash rather than them all. I use OneTrash and it works great! http://itunes.apple.com/us/app/onetrash/id414507097?mt=12

  • http://twitter.com/Artist_Sn33r OTF_Sn33r

    my mac keeps saying “loading items to trash” but its like it froze :S help??