Emptying the Mac OS X trash from the command line

When using a Mac OS X computer, it's easy to forget that it's just Unix running under the hood ... until your iMac graphics card dies and all you can do is use single-user mode, which has no GUI ... then you're reminded very quickly that it's all just Unix.

Take emptying the trash, for instance. Graphically, you right-click the Trash Can icon, then select the Empty menu option. From the Mac command line (Terminal) you just do this:

rm -rf ~/.Trash/*

It's funny how simple that is from the command line.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.