how to set the prompt to show the curent path

Posted on 2006-11-23
Last Modified: 2010-04-21
could comebody tell me what is the command that will make the prompt in  the terminal to show my current path?

Many Thanks

Question by:olchs
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

Expert Comment

ID: 18004393
in the /etc/profile you put this entry:

LVL 48

Assisted Solution

Tintin earned 300 total points
ID: 18004512
It's shell dependant.

Assuming ksh you do

export PS1='$PWD$ '

Assuming bash you do

export PS1='\w$ '

as well as

export PS1='$PWD$ '

for bourne shell, you need a bit of trickery.

Assisted Solution

karunamoorthy earned 200 total points
ID: 18005815
In unix, each indivudual have a separate username and password.
and also each user can change their own user profile settings through the hidden file called .profile

Hence after login to unix,
first edit the .profile file by using the following command,

vi .profile

and in the .profile file enter/edit  the following entry

export PS1=`$PWD>`

and save the file using :wq command

Now to make the changes to .profile to work/effect,
use relogin unix (i.e exit unix and login again).

thats all you got the required prompt.

you can also visit the following link to get more exmples for different shells

Have a nice day


Independent Software Vendors: 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!


Author Comment

ID: 18006553
Thank you all but i'd like to change it permanently for the root user . Therefore karunamoorthy is closer to what i want. But where exactly is is the .profile located?
and also, what else tdo i have to type to see the user as well as the path in the prompt?

Author Comment

ID: 18006554
by th eway i'm using the bash shell
LVL 48

Accepted Solution

Tintin earned 300 total points
ID: 18012506
For the bash root user do

vi ~/.bash_profile

and add

export PS1='\u \w# '

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.:
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.

756 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