I need Unix help

Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
Can someone please tell me how to access directories higher than my root directory?

~Thanks
 
Joined
Aug 25, 2006
Messages
1,395
Reaction score
30
Points
48
Location
Central Florida
Your Mac's Specs
MacBook Pro Unibody
Higher than / ? There is nothing higher than / , that is why it's called root.
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
Sorry, I meant home directory. I figured it out, though.

cd /Volumes/"Macintosh HD"
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
you can also cd / which nets the same thing, and is less typing
 
Joined
Mar 6, 2008
Messages
127
Reaction score
3
Points
18
Location
Devon, United Kingdom
Your Mac's Specs
17" eMac 1.42 GHz G4, Mac OS X 10.4 "Tiger"
Also, to move to directory above the current directory do this: cd ..

The two dots represent the directory above, so if you are in /home/folder1/ and wanted to be in /home/folder2/ you could simply do this: cd ../folder2/

Cool, no? :)
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
Thanks for all the helpful hints. Less typing=me being happier. So, the reason I asked is so I can get rid of this file. I've tried using

sudo rm -r /Volumes/"WINDOWS HD"/.Trashes/502/?␀␀␀ö?␀␀.?␀␀

but it says, "File name too long".

How can I get that file to go away? By the way, can anyone tell me why a weird file on my windoze partition would cause that problem when I delete trash in OS X?

~Damien
 
Joined
Mar 6, 2008
Messages
127
Reaction score
3
Points
18
Location
Devon, United Kingdom
Your Mac's Specs
17" eMac 1.42 GHz G4, Mac OS X 10.4 "Tiger"
In that directory, is it the only file named like that?

If so, try this: sudo rm /Volumes/"WINDOWS HD"/.Trashes/502/?*

This will delete ANY file with a "?" in front of its name, so be sure it the only one named this way first, otherwise you might knock out something else you don't want to.

If the file is actually a directory, use this instead: sudo rm -rf /Volumes/"WINDOWS HD"/.Trashes/502/?*
 
Joined
Jan 24, 2008
Messages
12
Reaction score
2
Points
3
"?" is a Wildcard as well

Be very careful with the use of wildcards and rm. Remember that in Unix, the question mark (?) is also a wildcard that means to match any one character. Thus your command "rm -rf /Volumes/"WINDOWS HD"/.Trashes/502/?*" will silently and recursively delete all files (and directories) that have at least one character in their name. Speaking of other nasties, absolutely do NOT issue that command "rm -rf .*" as this will silently and recursively delete all files beginning with a dot, including ".." which as has been previously stated is the directory above the present location. This means that if you were in say /usr/pmix and issued the offending command, you would erase not only /usr/pmix (and the targeted hidden files, but you would also erase all of /usr. I had a novice SA do this on a cluster once, spent the next four hours rebuilding the thing.
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
That didn't work. Anything else I can try?
 
Joined
Feb 13, 2005
Messages
1,186
Reaction score
73
Points
48
Location
New Orleans, LA, USA
Your Mac's Specs
13" Macbook Pro 2.26Ghz Unibody 4G RAM 160G HDD Superdrive
To tackle this one, I'd try to get a better idea of what characters that file is actually made up of. So I'd do something like (in Terminal.app) position myself in the .Trashes directory, then do a

$ ls | od -c

To get od (do a man on it, I forget what it stands for but it's a character dump utility) to show the characters to give you a better chance at forming an appropriate rm arg to get rid of the file. For example, currently I have two files in my .Trash:

Audio Hijack Pro.app cure-b-sides.jpg

ls | od -c

0000000 A u d i o H i j a c k P r o
0000020 . a p p \n c u r e - b - s i d e
0000040 s . j p g \n
0000046


Now I don't have any weird charactered file in my trash, but since you do, you might get a somewhat useful character representation of what that file really is named.
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
This is what I get when I try that:

What do I do now?

Terminal.jpg
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
BTW, why was this thread moved to "Windows, Linux, and Other OS"? It's about using Unix, the basis for Mac OS X.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
can you do the following and just cut and paste the output?

ls -al /Volumes/"WINDOWS HD"/.Trashes/502/

File attributes may help figuring out how to get rid of it.
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
damien-hand-cannanes-macbook-pro:502 Damien$ ls -al /Volumes/"WINDOWS HD"/.Trashes/502
ls: \004␀␀␀ö\001␀␀.\024␀␀: File name too long
damien-hand-cannanes-macbook-pro:502 Damien$
 

rman


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
I would do one of the following:

sudo rm -r /Volumes/WINDOWS\ HD/.Trashes/502

sudo rm -r /Volumes/WINDOWS\ HD/.Trashes/502/\?*
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
damien-hand-cannanes-macbook-pro:~ Damien$ sudo rm -r /Volumes/WINDOWS\ HD/.Trashes/502
Password:
rm: /Volumes/WINDOWS HD/.Trashes/502/\004␀␀␀ö\001␀␀.\024␀␀: File name too long
rm: /Volumes/WINDOWS HD/.Trashes/502: Directory not empty
damien-hand-cannanes-macbook-pro:~ Damien$ sudo rm -r/Volumes/WINDOWS\ HD/.Trashes/502\?*
rm: illegal option -- /
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Need a space between - and /

To remove the entire directory you'd need to do

sudo rm -rf /Volumes/"WINDOWS HD"/.Trashes/502/

I was hoping there'd be a username for that dir so we could do a

find /Volumes/"WINDOWS HD"/.Trashes/502/ -user <uname> -exec rm -f {} ';'

Hrm... thinking about it...

find /Volumes/"WINDOWS HD"/.Trashes/502/ -nouser -exec rm -f {} ';'

might just work, but I'd do this first and make sure it returns what you want. Because the above statement deletes ANYTHING returned by that find command. Blindly. (you should never rm from a find unless you know the returned items, period.)

sudo find /Volumes/"WINDOWS HD"/.Trashes/502/ -nouser
 
OP
Thundermoon1994
Joined
Dec 26, 2006
Messages
495
Reaction score
7
Points
18
Location
Kent, OH
Your Mac's Specs
15" MacBook Pro w/ 2.4 GHz C2D, 4 GB RAM, 250 GB
damien-hand-cannanes-macbook-pro:~ Damien$ sudo find /Volumes/"WINDOWS HD"/.Trashes/502 -nouser
find: /Volumes/WINDOWS HD/.Trashes/502/\004␀␀␀ö\001␀␀.\024␀␀: File name too long
 
Joined
Jan 24, 2008
Messages
12
Reaction score
2
Points
3

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top