Solved

how to set the prompt to show the curent path

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

Many Thanks

Christos
0
Comment
Question by:olchs
6 Comments
 
LVL 6

Expert Comment

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

PS1='SERVERNAME:`pwd`>'
0
 
LVL 48

Assisted Solution

by:Tintin
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.
0
 
LVL 7

Assisted Solution

by:karunamoorthy
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
http://kb.iu.edu/data/abee.html

Have a nice day

from
karunamoorthy.






0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:olchs
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?
0
 

Author Comment

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

Accepted Solution

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

vi ~/.bash_profile

and add

export PS1='\u \w# '
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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…
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.

831 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