Solved

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

Posted on 2004-03-29
4
672 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

717 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