Solved

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

Posted on 2004-03-29
4
633 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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.:
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now