Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

King Cobra

macrumors 603
Original poster
Mar 2, 2002
5,403
0
How do you emergency-empty whatever is in the Trash, even with locked items inside, in 10.1?

I don't want to boot into OS 9 to unlock all these files I found on my iBook (I copied Appleworks several times, and wound up with all these invisible locked items for OS X, so I have to boot to OS 9 to delete them all.)


P.S.: If anyone else has basic terminal questions, post 'em here as well.
 
force it

If you want to trash things in a hurry... even protected files then you need to have sudo or root priveges. Do you have root user enabled on your mac? You must do that first. You probably dont want to log in as root all the time so here are you options.

YourUserName% cd /Users/YourUserName/.Trash
(cd is a command to "change directories" the path shown is the path to your trash can)
YourUserName% sudo rm -rf *

(you will be promted for YourUserAccount password.. not the root password)


or

YourUserName% su -
(you will be prompted for the root password)

root% cd /Users/YourUserName/.Trash
root% rm -rf *
root% rm -rf .*
(to trash invisable files that have a "." infront of them)

Be carfull with rm -rf * it will trash everything in the current directory that does not have a "." infront of it. It is a very powerfull command. If you did a rm -rf / you would trash everything on your partition... well... if the rm utility is loaded into RAM.. if its not.. it will trash its self in the bin directory and kill the process.. but its still very very bad. Be carefull.
 
hahah...

I was wondering why he wanted to know how to delete in a hurry.

I forgot to mention that you can put those commands in a double clickable script by putting the extention .command on the end of the file name... and you have to have the right shell scripting stuff as well in the file.

#!/bin/sh
.. then the commands

The only problem is... if you want to trash stuff in a hurry so no one well find it... this is not the way to do it. Some one could take your drive and recover the stuff you trashed. The only way to really get rid of the stuff is to "Zero out the drive" or the partition. When you trash something all you do it break the link that your OS has to the point on the drive with the data stored on it. The data is still there untill you write over it.
 
Originally posted by MacBandit
The FBI is knocking at the door how can I delete kiddie pron in the trash in hurry.

With a big magnet!

:D

very sick :eek: :eek: :eek:

But it made me giggle....... :p :p :p
 
I'm in 10.1.5, and I cannot get it to work.

I tried using both option 1 and option 2, and I keep getting some "command not allowed" or something like that.

Also, instead of "root%", I'm getting "root#". What's going on?

BTW: It's not an emergency. I said emergency-empty, 'cause I didn't think of force-delete. It's not porn. :rolleyes:^2. It's some locked Appleworks files I can manually delete in OS 9, one by one. But the Terminal commands are not working.
 
you could also try deleting and doing a quick defrag or duplicate a whole bunch of huge folders to get rid of your special files.... :D

but back on topic, can't you still hold down the option key while emptying to (at least) get rid of the locked files?
 
root#

It doesnt work on your cube... are you sure you have root user enabled on your Cube?

The prompt doesnt matter... root# or root% or # or bash# ... etc

Just as long as you are root. you can trash anything. I'm not sure why it doesnt work for you. I'm not in front of my mac right now so I cant try it.

Try moving your files out of the trash can and try the commands from the new location.

example:

root# rm -rf /FullPath/TheFileyouWantToTrash

if your not alowed to do it... then your not root. Did you use sudo or did you login as root?

# su -
(enter root password)
root# rm -rf /FullPath/TheFileYouWantToTrash

You may want to make a directory to put your trash in and wipe that out... so you dont get too crazy and trash everything.

cd /Users/Username/Desktop/TrashFolder
# pwd
(you should get this back) : /Users/Username/Desktop/TrashFolder
rm -rf *

.
that should work as long as your root. Copy and past your output to me ... we can talk about it more if you have problems
 
No matter what I do, I get these types of errors:

"rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/AppleWorks 6: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/Clippings: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/Starting Points: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS: Directory not empty
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Clippings: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Starting Points: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic: Directory not empty
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents: Directory not empty
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app: Directory not empty
rm: delete/Hard Drive 2/AppleWorks 6: Directory not empty
rm: delete/Hard Drive 2: Directory not empty
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/AppleWorks 6: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS/Clippings: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS/Starting Points: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS: Directory not empty
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Clippings: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Starting Points: Operation not permitted
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic: Directory not empty
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents: Directory not empty
rm: delete/Hard Drive usage/AppleWorks 6/AppleWorks.app: Directory not empty
rm: delete/Hard Drive usage/AppleWorks 6: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/AppleWorks 6: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS/Clippings: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS/Starting Points: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOS: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Clippings: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Starting Points: Operation not permitted
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app/Contents: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6/AppleWorks.app: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage/AppleWorks 6: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home/Hard Drive usage: Directory not empty
rm: delete/Hard Drive usage/KC Folder Home: Directory not empty
rm: delete/Hard Drive usage: Directory not empty
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/AppleWorks 6: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOS/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOS/Clippings: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOS/Starting Points: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOS: Directory not empty
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Clippings: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic/Starting Points: Operation not permitted
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents/MacOSClassic: Directory not empty
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app/Contents: Directory not empty
rm: delete/Hard Drive usage 22/AppleWorks 6/AppleWorks.app: Directory not empty
rm: delete/Hard Drive usage 22/AppleWorks 6: Directory not empty
rm: delete/Hard Drive usage 22: Directory not empty
...


And it just goes on for ALL the files.

Any more suggestions, bigevil?
 
hmmm

... post the exact commands that you did... starting from when you su to root.

Also to a

# cd /Path/YourTrashFolder
# ls -al

and post what you see there too. I want to take a look at the permissions and ownership

Do you have more than one drive or one partition on you Mac? Did you mount them as read only?

Are any of those files in use? Try a reboot and try again.
 
Originally, here is what I did:

"[localhost:~] kc% cd /Users/kc/.Trash
[localhost:~/.Trash] kc% sudo rm -rf *
Password: [accepted]
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/AppleWorks 6: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/AppleWorks Essentials: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/Clippings: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/Starting Points: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS: Directory not empty
[etc.]
[localhost:~/.Trash] kc%"


Here is the same thing with root user:

"[localhost:~] kc% su -
Password:
[localhost:~] root# cd /Users/kc/.Trash
[localhost:/Users/kc/.Trash] root# rm -rf *
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/AppleWorks 6: Operation not permitted
rm: delete/Hard Drive 2/AppleWorks 6/AppleWorks.app/Contents/MacOS/AppleWorks Essentials: Operation not permitted
[etc.]
[localhost:/Users/kc/.Trash] root# rm -rf .*
rm: "." and ".." may not be removed
[localhost:/Users/kc/.Trash] root#"


Here is what I get with the "ls":

"[localhost:~] kc% su -
Password: [accepted]
[localhost:~] root# cd /Users/kc/Desktop/delete
[localhost:kc/Desktop/delete] root# ls -al
total 0
drwxrwxrwx 8 501 staff 264 Sep 20 17:17 .
drwxrwxrwx 7 kc staff 194 Sep 20 18:39 ..
drwxrwxrwx 3 501 staff 264 Sep 20 06:46 Hard Drive 2
drwxrwxrwx 4 501 admin 264 Sep 20 17:17 Hard Drive usage
drwxrwxrwx 3 501 staff 264 Jul 21 14:58 Hard Drive usage 22
drwxrwxrwx 4 501 staff 264 Sep 20 06:29 KC Folder Home
drwxrwxrwx 3 501 staff 264 Jul 21 14:58 Other
drwxr-xr-x 3 503 staff 264 Sep 13 17:23 kc Deleted
[localhost:kc/Desktop/delete] root#"


Nothing changed after reboot. I also did a fsck -y recently and reset the open firmware recently. I've recorded this data in TextEdit (AppleWorks is not active).
 
hmmm

Im going to have to think about this...

the ls -al you did shows that you didnt even need to be root to trash those files. they are totaly open. Try one more thing before you try and delete them.

# su -
(enter password)
# cd /users/UserName/.Trash
# chmod 777 *
# chown root *
# chgrp wheel *

Then do the...

rm -rf *

Those commands will make root the owner of the files. I dont know what owner 501 is.. but that could be a problem. Im not sure if this will work but its worth a try.

-evildead
 
*my* root appears broken

Am I missing something? I'm not very good with terminal.
Please help :(

Normal:

Last login: Wed Sep 18 19:11:14 on console
Welcome to Darwin!
[alb-24-169-30-135:~] ja0912% ..
/usr/bin/..: Permission denied.
[alb-24-169-30-135:~] ja0912% public/
public/: Permission denied.

With Root:

[alb-24-169-30-135:~] ja0912% login
login: root
Password:
Last login: Sun Sep 15 05:34:10 on console
Welcome to Darwin!
tcsh: Cannot open /etc/termcap.
tcsh: using dumb terminal settings.
[alb-24-169-30-135:~] root# ls
.CFUserTextEncoding .forward .ssh Desktop
.Trash .nsmbrc .tcsh_history Library
[alb-24-169-30-135:~] root# ..
/usr/bin/..: Permission denied.
[alb-24-169-30-135:~] root#
 
There is nothing that is really wrong. You should be able to use root normally even after getting those messages. Use the su command to use root without those errors.

The reason those errors are occurring is because when you use the login command, tcsh (the command shell or interpreter) does some extra things at startup. With root this causes a few problems that don't occurr normally. I'm not entirely sure what is occurring, but it really isn't important. Just use su.

Taft
 
like this?

Last login: Sat Sep 21 15:26:56 on ttyp1
Welcome to Darwin!
[alb-24-169-30-135:~] ja0912% su -
Password:
[alb-24-169-30-135:~] root# ..
/usr/bin/..: Permission denied.
 
"other"

Originally posted by King Cobra
Nope. Still no luck.


When you get to the log inscreen do you have an "Other" option? There used to be an option to turn that on in OS 10.1 and now i cant find it... I have Other listed as a user on my login screen (10.2) try and Log in from the log in screen as root user and then try and just dragging the files to the trash can and delete them that way... see what happens.

-evildead
 
Re: like this?

Originally posted by ja0912
Last login: Sat Sep 21 15:26:56 on ttyp1
Welcome to Darwin!
[alb-24-169-30-135:~] ja0912% su -
Password:
[alb-24-169-30-135:~] root# ..
/usr/bin/..: Permission denied.


Have you ever used root before? Did you enable root user in the NetInfo Util?
 
Root user: Hard Drive > Apps > Utils > Netinfo smthnthr basically is a pathway for enabling root user. Then I can log in with
Name: root
PW: [.......]

Dragging the folder to the trash and Apple - Option - Delete - Return worked.


So now I know to log in as root user. I keep root user temporarily available, in case something like this comes up anyways. :) :cool:
 
Re: like this?

Originally posted by ja0912
Last login: Sat Sep 21 15:26:56 on ttyp1
Welcome to Darwin!
[alb-24-169-30-135:~] ja0912% su -
Password:
[alb-24-169-30-135:~] root# ..
/usr/bin/..: Permission denied.

.. is not going to work, root or no root.

When you type .., you are effectively trying to execute the parent folder of the current folder. Since folders are not binaries, scripts or otherwise executable entities, this will never work. Other shells might allow this (meaning, I suppose, go up a folder), but tcsh does not.

If you are trying to navigate up a level, try:

cd ..

This says cd=change directory, ..=parent of current directory. You must use the cd command to switch directories. The fact that you got no errors when executing the su command indicates to me that root is enabled and working properly.

Taft
 
Originally posted by King Cobra
Root user: Hard Drive > Apps > Utils > Netinfo smthnthr basically is a pathway for enabling root user. Then I can log in with
Name: root
PW: [.......]

Dragging the folder to the trash and Apple - Option - Delete - Return worked.


So now I know to log in as root user. I keep root user temporarily available, in case something like this comes up anyways. :) :cool:


so.... root user was not enabled in NetInfo? that is why the command line stuff didnt work ... i guess. You shouldnt have been able to su to root... so i dont know. Oh well.. as long as you got it to work. Its rar that you need to trash stuff as root anyway. Admin accounts are normaly good enuph.
 
Re: "other"

Originally posted by evildead



When you get to the log inscreen do you have an "Other" option? There used to be an option to turn that on in OS 10.1 and now i cant find it... I have Other listed as a user on my login screen (10.2) try and Log in from the log in screen as root user and then try and just dragging the files to the trash can and delete them that way... see what happens.

-evildead

I noticed the same thing - but, it seems that when you enable root user in NetInfo, it automatically adds the "Other" user in the login screen - when you turn root off, it's not there at the next login. There isn't an option to turn it on or off. Or is this just me? ;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.