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


Industry Leaders: 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

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!

Question has a verified solution.

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

Suggested Solutions

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…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

734 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