[HOWTO] - Show Unix path in Finder window or Terminal Window?

Iolaire

Registered
Since I'm unfamiliar with the Unix paths and many things require you to know that path to a file now - is there a way to make the window toolbar show the Unix path to the current folder?
i.e. /applications/utilities/ or even the "apple path": Macintosh HD:Applications:Utilities.

Alternately if that can not be done is there a small fast utility that will give it to you in a copyable field?
Thanks,
iolaire
 

scruffy

Notorious Olive Counter
I use
set prompt = "%B: %?%b%{\033]0;%n@%m:%c3\007%}%B %T; %b"
This puts the exit status of the last command, and the time it exited, in bold, and between : and ; (this allows cutting and pasting entire lines, since the shell ignores things between : and ; ) on the main window ( like : 0 15:01 ; ). In the title bar goes "username@computername:/where/I/am"
 

Kartoffel

5038 Member
You can have your .bash_login set the window title. Mine is set up with the form <b>[username]@[hostname] :: [path]</b>

<tt>TITLEBAR='\[\033]0;\u@\h :: \w\007\]'
export PS1="${TITLEBAR}\n[\w]\$ "</tt>
 

sinebubble

Registered
Kartoffel,
You-Are-The-Man=Kartoffel; export You-Are-The-Man

I love that tip. I routinely have 10 ssh sessions running and I'm tired of shift-command-t 'ing each window just to get a hostname in the titlebar. Wow!
 

genghiscohen

Membrum virile
Ummm, are these answers providing a little more detail than the original question was seeking?
When you open the Customize Toolbar window, one of the available choices that you can add is Path.
Just my $0.02 worth...
 

Iolaire

Registered
Thanks for all the help!
I must say that genghiscohen is thinking along the same lines as me.

I have selected Customize Toolbar Path, this is what got me seeking the full path in a text format. What I'm seeking is in a normal finder window to have the UNIX path rather than the drop down "Mac" path given in the Customize toolbar Path in a paste-able method.

i.e. no path button but instead:
/applications/utilities/
or
Macintosh HD:Applications:Utilities
--- in the finder window not a shell window

My thinking is that the toolbar can be customized and thus someone should be able to do the same for the finder window as they suggest doing for the shell windows.

Don't ask me exactly how I would benefit from this feature, but I find it very helpful on the PC at work (usually creating a shortcut or sending a link to a networked file via email). I think it would help me get familiar with the deep folders that we are working with now on X.
Thanks,
iolaire
 

dkearford

Registered
I made this applescript droplet earlier today to do something similar - its abit sloppy and comes with no guarantees, but it should work.

on open (daFile)

-- define variables
set daFile to daFile as string
set daPath to "" as string
set badChar to {space, "'", "\"", "*", "?", "[",} -- etc
set i to 1

-- check each char of daFile
repeat while i <= (the length of daFile)
set j to 1
set daChar to character i of daFile

-- file or directory?
if daChar is ":" then
set daChar to "/" -- directory
else if daChar is "/" then -- file
set daChar to ":"
end if

-- test against list of bad chars
repeat while j <= the number of items in badChar
if daChar is (item j of badChar) then
set daChar to "\\" & (item j of badChar)
end if
set j to j + 1
end repeat

-- update daPath
set daPath to daPath & daChar

-- loop
set i to i + 1
end repeat

-- name of startup vol
tell application "Finder"
set startupvol to the startup disk as string
end tell

-- name of disk of daFile
set thisDisk to the first word of daFile & ":"

-- reconstruct daPath
if thisDisk is startupvol then
set i to 1
repeat while character i of daPath is not "/"
set i to i + 1
end repeat

set daPath to (characters (i) thru (the length of daPath) of daPath) as text
else
set daPath to "/volumes/" & daPath
end if

-- put daPath on clipboard
set the clipboard to daPath
end open

hope this is of some use
 

PowerPC

Registered
Scruffy, but where do your put the script so that you don't have to type "set prompt =" every time you start a terminal session ?

I also couldn't find any "bash_local" file to edit :(

Thanks.
 

michaelsanford

Translator, Web Developer
PowerPC, you put the set prompt = "" command into your ~/.login file, which is read every time you start a shell.
As with most things unix, if you don't have that file, just make one :)

This is what my (~/.login) looks like:
Code:
set prompt = "[helios:%~]%# "
date;uptime;ifconfig ppp0 | grep inet | awk '{print $2}';mysqladmin ping;
Which gives me a nice printout like this
Code:
      Welcome to Helios
// AUTHORIZED PERSONNEL ONLY //

Thu Feb 20 21:54:33 EST 2003
 9:54PM  up 7 days,  8:54, 3 users, load averages: 0.37, 0.07, 0.03
64.230.12.222
mysqld is alive
[helios:~]%
Incidentally the bit above the date about authorized people only is contained in /etc/motd (Message Of The Day) and is a non-executable text that's displayed to all users who start a shell.
 

symphonix

Scratch & Sniff Committee
And here's a tip that many would find painfully obvious, but it is useful nonetheless.

If you drag a file from the finder onto an open terminal window, it enters the file's full path at the prompt.

So, you could type P-I-C-O-Space and drag a config file onto the window, and the command line would read:

pico /path/to/configfile
 

PowerPC

Registered
Thanks, Michael!

Actually I put it into /etc/csh.cshrc and it works! But I forget to mention it on macosx.com. Hope it's not too late :)) Thanks, again :)
 
Top