[X4U] Terminal | Emptying the trash

Randy B.Singer randy at macattorney.com
Thu Mar 17 11:17:09 PST 2005


verduron said:

>I cannot find the info someone once passed on to me.
>I have so many locked items in the trash, that I want to use the empty 
>the trash command in terminal.
>Would someone reminds me what it is?

Here are three different ways to go, in order of easiest/safest to most 
complex and dangerous:


Locked files can easily be deleted if you hold the Shift-Option key 
combination while emptying the Trash.


If there are several locked files in the Trash, you can unlock them all 
at the same time in Terminal. Follow these steps:

   1. Open Terminal.
      Type: chflags -R nouchg
      Note: Type one space (not pictured) after nouchg in the line above, 
so that it ends in "nouchg ". Do not press Return yet.
   2. Double-click the Trash icon in the Dock to reveal the contents of 
the Trash. If necessary, arrange the Finder window so that a portion of 
the Terminal window is still visible.
   3. Press the Command-A key combination to select all files in the 
Trash.
   4. Drag the files from the Trash to the Terminal window.
      Note: This automatically enters the pathname for each file. This 
eliminates the need to individually empty multiple Trash directories, 
particularly when multiple disks or volumes are present.
   5. Press Return. No special text message will be shown indicating that 
the command was successful.
   6. Empty the Trash.


To delete anything in the Trash, not matter what it is, do this.  Open 
the terminal and type:
  
  cd ~/.Trash
  <hit return>
  
  sudo rm -rf
  <put a space after the f and drag the items you want deleted to the
  terminal so that their path is automatically entered, then press return>
  
  <enter your admin password and hit return>



Randy B. Singer
Co-Author of: The Macintosh Bible (4th, 5th and 6th editions)

Routine OS X Maintenance and Generic Troubleshooting
http://www.macattorney.com/ts.html 



More information about the X4U mailing list