Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-20-2005, 06:03 PM   #1
LQ Newbie
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
change profile to show current directory

What do I need to add to my .profile file so that the user logged in will show his current absolute path?

Old 01-20-2005, 06:34 PM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Edit your .bashrc to look like this:
# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
or borrow the appropriate line
Old 01-20-2005, 07:36 PM   #3
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Originally posted by jpolachak
... so that the user logged in will show his current absolute path?
Are you referring to the shell prompt?

If so, then you want to modify the PS1 environment variable. From a command line, execute these statements:
echo $PS1
should see some output
export PS1='\u@\h:\w\$ '
That should change your prompt to look something like this:

"\u" is replaced by the user name
"\h" is replaced by the host's name
"\w" is replace by your current directory (with a ~ representing your home directory)
"\$" is replaced with a $ if you're a normal user or a # if you're the super user

You can do lots of customization. Type man bash and search for the PROMPTING heading (hit the forwad slash ( / ) and type PROMPTING; hit "n" until you find the proper section heading). It will list the backslash codes and what they translate to.

If you find something you like, make the change permanent by putting your PS1 assignment into your ~/.bash_profile. If you don't see a line that gives a value to PS1 in that file, then just add the export command above to the end of the file. Just substitute your customized sequence instead of what I used.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can change user profile directory reply2vinay Linux - Security 3 09-02-2005 08:33 AM
Why dont my HCL and Review Post's show up in my profile UsualTuxpect LQ Suggestions & Feedback 2 10-22-2004 05:01 AM
show complete current paht creilar Linux - Newbie 1 05-24-2004 04:50 AM
command to show current display resolution ?? itsjustme Slackware 4 12-05-2003 01:59 PM
How to change the path of the current directory ? ndha Linux - General 7 12-03-2003 11:05 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:46 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration