Solved

how to set the prompt to show the curent path

Posted on 2006-11-23
6
472 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
Comment Utility
in the /etc/profile you put this entry:

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

Assisted Solution

by:Tintin
Tintin earned 300 total points
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:olchs
Comment Utility
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
Comment Utility
by th eway i'm using the bash shell
0
 
LVL 48

Accepted Solution

by:
Tintin earned 300 total points
Comment Utility
For the bash root user do

vi ~/.bash_profile

and add

export PS1='\u \w# '
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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.

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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now