?
Solved

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

Posted on 2004-03-29
4
Medium Priority
?
677 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

762 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