Solved

What is the command to find the path of my current location?

Posted on 2004-03-29
4
666 Views
Last Modified: 2010-04-21
Hi ALl,

 This must be very simple.  THis is a two fold question.  

1.  What is the Unix command that tells me the complete path of my location.
2.  How can I modify my .profile so that the current location and path is always displayed.

Regards

0
Comment
Question by:jcosta_sr
4 Comments
 
LVL 7

Accepted Solution

by:
fim32 earned 50 total points
ID: 10709592
pwd

depends on your shell, using .profile so i'll assume ksh?

export PS1=`echo '$PWD> '`

or some such
0
 
LVL 48

Expert Comment

by:Tintin
ID: 10709878
1.  /bin/pwd  (note that the shell inbuilt pwd will not resolve symbolic links)
0
 
LVL 7

Expert Comment

by:glassd
ID: 10711768
If you are using xterms, amd ksh, try this out. It will display the path in the title bar of the xterm. Useful if the path is long and takes up a significant part of the command line.

Put this in your .profile.

Note that the control characters ^[ and ^G are entered into vi by preceding the character with Ctrl-V, for example Ctrl-V Ctrl-[

case $TERM in
        xterm*)
                HOST=`hostname`
                PS1="${LOGNAME}@$(uname -n): "'^[]0;${HOST}:${PWD}^G'
                ;;
        *)
                PS1='ksh$ '
                ;;
esac

This will show the hostname and user name at the start of then command line and the path in the title bar.



fim32 - you might be intersted in this:

We used to use the '>' character at the end of the prompt but we were cursed by lazy users. Many of them would use the mouse to cut and paste previous commands. Assuming the previous command was 'ls', if they were careless with the mouse they would pick up '> ls'  . If they then pasted this onto a new line they would create an empty file called 'ls'. Since many had './' in there current directory, next time they tried to run 'ls' they tried to run an empty file with incorrect permissions. Once we realised what was happening, we ended up using the colon at the end of the prompt instead.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10713036
1. echo "cwd=$cwd; pwd=`/bin/pwd`";/bin/df -k .|/usr/bin/tail -1
2.  depends on your shell, which shell do you use? (check with: echo $SHELL)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question