Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unistall fileset without dependecies on AIX 3 60
Write an app 10 67
unix example issues 18 75
Wrap Oraccle SQL*Plus executable Command 4 69
Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

895 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