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

BicyclePunk

macrumors regular
Original poster
Aug 26, 2002
187
0
Somewhere near Philadelphia
Ok, this whole thing with the Terminal is new to me. But I am trying to empty my Trash because I have a TOn of locked files (That mysteriously became locked, but that's a different question that can be addressed later). Anyway....I was able to use "sudo rm -r ~/.Trash/*" to clear my Trash once. Now when I try to do it, nothing happens. Here is a sample of what I have done in the Terminal:

Last login: Tue Feb 11 09:32:59 on ttyp1
Welcome to Darwin!
[dsl000-000-000:~] username% login
login: username
Password:
Last login: Tue Feb 11 09:34:56 on ttyp1
Welcome to Darwin!
tcsh: Cannot open /etc/termcap.
tcsh: using dumb terminal settings.
[dsl000-000-000:~] username% "sudo rm -r ~/.Trash/*"
sudo rm -r ~/.Trash/*: Command not found.
[dsl000-000-000:~] username%

Am I doing something wrong? Is there an easier way to force empty my trash? Thanks in advance.

...Jeff
 

FredAkbar

macrumors 6502a
Jan 18, 2003
660
0
San Francisco, CA
Re: "sudo rm -r ~/.Trash/*" and terminal ?

Originally posted by BicyclePunk
tcsh: Cannot open /etc/termcap.
tcsh: using dumb terminal settings.

This stuff that I have quoted shouldn't be showing up. This has happened for me occasionally, but to be honest, I don't really know how to fix this. It's pretty simple though, I believe. All I can tell you is that yes you are entering the sudo command correctly--it just isn't working properly. Make sure you are logged in as an administrator...and it won't hurt to repair your disk permissions (using Disk Utility). Sorry I can't help more than that.

--Fred
 

yzedf

macrumors 65816
Nov 1, 2002
1,161
0
Connecticut
try this:

# sudo rm -fr ~/.Trash/*

-fr means force and recusrsive (for directories and such)

___

also:

# cd .Trash
# ls

that will move you to the .Trash directory and display what is in directory .Trash

then try

# rm -fr *

______

I take it using the GUI is not working? Or are you just wanting to learn the command line interface (CLI)?

Good luck. :)
 

BicyclePunk

macrumors regular
Original poster
Aug 26, 2002
187
0
Somewhere near Philadelphia
Ok, as far as I know, I am logging in as the administrator since I only have one user, me, on the machine.

I tried both of yzedf's methods for emptying the trash. The first method didn't work. But when I used the second method and got into the Trash directory, I only saw the new files that I put in the trash. The locked ones, that I can't remove, were not showing. I ran the command and it got rid of the newly trashed files, but the old ones are still stuck in there.

Basically, I just want to get rid of this stuff in the trash. I was told using the sudo command in the Terminal was the quickest way. I can go into the trash and manually unlock all of the files, but there is a lot of them. And that is really frustrating. Why would these files lock themselves?

Thanks for any more insight you can provide.
 

peterjhill

macrumors 65816
Apr 25, 2002
1,095
0
Seattle, WA
Just because you are logged into an administrative account, does not mean that you have root priv's. You could set your root password (Applications -> Utilities -> NetInfo Manager ->Security Menu

You will need to authenticate, enable the root user, set a password. Then you can log out, log in as root, and try to empty the trash.

You can open your other users trash folder in the gui by using either the Finder -> Go menu, or terminal.

In go menu, you can select "Open Folder" and type in ~username/.trash

or in the terminal "open ~username/.trash

where username is the username of the user with the trash (obviously)

Those are also handy ways to open your tftpboot directory "/private/tftpboot" and /etc directory. Lots of fun
 

yzedf

macrumors 65816
Nov 1, 2002
1,161
0
Connecticut
Originally posted by BicyclePunk
Ok, as far as I know, I am logging in as the administrator since I only have one user, me, on the machine.

I tried both of yzedf's methods for emptying the trash. The first method didn't work. But when I used the second method and got into the Trash directory, I only saw the new files that I put in the trash. The locked ones, that I can't remove, were not showing. I ran the command and it got rid of the newly trashed files, but the old ones are still stuck in there.

Basically, I just want to get rid of this stuff in the trash. I was told using the sudo command in the Terminal was the quickest way. I can go into the trash and manually unlock all of the files, but there is a lot of them. And that is really frustrating. Why would these files lock themselves?

Thanks for any more insight you can provide.

What are the names of the locked files? Are they files you have created? System files?

As for "administrator" this is not Windows 2000. By default, you are NOT the administrator. When you boot into OS X you have 2 accounts on the machine. Yours (mine would be called "yzedf") and the "root" account. Your account does not have permission to do certain things. This is for your safety. Newbies have a tendency of deleting things that they don't think they need. Most often, these turn out to be files that are necessary for the system to run.

Another thing, if you are doing the same task over and over again, as "root" user (sudo gives you root access for 1 command only), you want to do the following:

# su
# enteryourpasswordhere

then you will be logged in as root (administrator).

do what you need. then:

# Ctrl-d

(hold down Ctrl key, and type the letter d)

or you can use:

# logout (maybe exit, can't remember...)

Please be careful. If you don't recognize the file, and it is locked, there may be good reason. Go to Google and do a search for the exact name of the file, including extension. Most likely, you will find out what it is for, and if it should be there or not.
 

peterjhill

macrumors 65816
Apr 25, 2002
1,095
0
Seattle, WA
ah, try this:
[TITAN:~] phill% cd /
[TITAN:/] phill% su
Password:
[TITAN:/] phill# cd .Trashes/
[TITAN:/.Trashes] phill# ls -a

See what that says. From here try your:

rm -ri /.Trashes/*
 

daytona63

macrumors member
Feb 11, 2002
63
0
San Diego, CA
This could work too

you could also create a new folder on your desktop, then move all the files in the Trash to that folder, then remove that folder from the command line using

sudo rm -r nameofyourfolder
 

BicyclePunk

macrumors regular
Original poster
Aug 26, 2002
187
0
Somewhere near Philadelphia
yzedf: the stuff in the trash I need to get rid of is stuff I made myself or cached web stuff or documentation. Nothing important, I can see. And the:
# su
# enteryourpasswordhere

didn't work for me. That's as far as I got.

peterjhill: First off, I could really go for a Primanti's and an IC Light right about now. Secondly, I couldn't get the phill% cd / command to work. I assume I leave off the [TITAN:/~] part, right? Thanks.
 

yzedf

macrumors 65816
Nov 1, 2002
1,161
0
Connecticut
looks to me like you need to chmod all the files in your trash.

# chmod 777 * (when you are in the trash directory logged in as root)

# rm -f *

or

# sudo chmod 777 *

# rm -f * (while in trash directory)
 

yzedf

macrumors 65816
Nov 1, 2002
1,161
0
Connecticut
Originally posted by BicyclePunk
I'm going to try that chmod thing next time this happens. Thanks. I did what daytona63 suggested and all that stuff is gone now. Thanks for all your help!

cool

hopefully won't happen again ;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.