unix help please

jelloshotsrule

macrumors G3
Original poster
Feb 7, 2002
9,594
3
serendipity
related to my other question but simpler:

there is a file that is in the trash but i cannot get it to delete. ie, it doesn't show up in there.

under os 9 i can do a find for it and it shows up under harddrive/trashes/501... but it won't let me touch it.

under os x it doesn't show up at all. i am signed in as root user.

i assume i could probably best get rid of it via the terminal... could someone shed some light onto how?

thanks in advance..
 

PCUser

macrumors regular
Mar 1, 2002
123
0
The bash commands required would be 'cd' and 'rm'.

#cd <directory path to file>
#rm -f <filename>

The 'rm -f' makes it force the removal.
 

jelloshotsrule

macrumors G3
Original poster
Feb 7, 2002
9,594
3
serendipity
sorry to be dumb... but what would the directory path end up being...?

using greg's browser in os 9, i am able to see the file in my:

"harddrive/Trashes/501/file"

the thing is that the "trashes" appears to be .Trashes and both it and the 501 are invisible and i can't see them in os x....

so any more specific you could be as far as the directory path would be great... thanks a ton.
 

Baseline

macrumors member
Apr 9, 2002
85
0
Southern Ontario
Well, in *nix, a '.' in front of a filename or directory means it's hidden. It's just a simple hiding scheme though.

If the directory is listed in OS 9 as harddrive/Trashes/501/file,
then in OS X it's probably (note: I don't even own a Mac so I don't have OS X. I'm going by my Linux knowledge here)

/harddrive/.Trashes/.501/file

Try this. Open a terminal and
1) "cd /harddrive/.Trashes"
2) "cd .501" If that doesn't work (it says directory doesn't exist or something) then try "cd 501"
3) "ls" This will print the contents of the current directory, make sure that the file is really there
4) "rm -f filename" This will forcibly remove the file (ie. won't ask you for Yes/No confirmation. Take out the -f if you want that confirmation)

Hope this helps! Anyone who actually *uses* OS X, please correct any mistakes I've made in terms of OS X directory structure.
 

Taft

macrumors 65816
Jan 31, 2002
1,319
0
Chicago
New layout for trashes.

The newest version of OS X has a new way of dealing with trashes. Previously, all trash was put under /.Trash under seperate folders for each user (ie 501 for user1, 502 for user2, etc.).

It seems as though Apple is moving in a more intelligent direction with OS X 10.1.4. Now, they are putting each user's trash inside the users folder. For example, all user1's trash would be put in /Users/user1/.Trash

This does present a problem, however, when dealing with drives other than the main drive. In this case, they still use the more cryptic system with .Trashes at the root level of the drive and user folders underneath. I still think this is a step in the right direction though. It will make managing trash much easier for those users who don't have partitions and multiple drives (ie your average Mac user).

Matthew
 

mc68k

macrumors 68000
Apr 16, 2002
1,996
0
Originally posted by Baseline
3) "ls" This will print the contents of the current directory, make sure that the file is really there
Just a nitpick, if the file is hidden (prefixed with a dot), then the ls has to be followed by the -a switch.

I'm sure you know this, but I just wanted to clarify.
 

Baseline

macrumors member
Apr 9, 2002
85
0
Southern Ontario
D'oh! How could I forget something so basic? I guess that's what I get for using Win95 exclusively for five days straight...

BTW it also works with -A, which for some reason I prefer to use :)
 

mc68k

macrumors 68000
Apr 16, 2002
1,996
0
You can also truncate ls down to l (as if this command wasn't short enough already!)

Originally posted by Baseline
D'oh! How could I forget something so basic? I guess that's what I get for using Win95 exclusively for five days straight...
Win95 for five days straight? I pity you… :) I have the opposite problem sometimes, typing in ls in place of dir. The command ls is actually recognized in Win95 but is more limited than dir.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.