LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-22-2005, 02:46 AM   #1
Lance56
LQ Newbie
 
Registered: Jan 2005
Posts: 1

Rep: Reputation: 0
newbie :(


Hey on the command line it says
[lance@localhost lance]$

and i was wondering how i can change that
i know the first word is the "user", i just figured that out, i changed it awhile ago
now it's
[retro@localhost lance]$

i was wondering what the last word means and how i can edit/change it
 
Old 01-22-2005, 02:57 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
You want to modify the PS1 enfironment variable. Do this at a prompt:
Code:
echo $PS1
You'll see something like:
[\u@\h \w]\$

Again, yours may be different. All those backslash-character combinations represent something significant to the shell, and they get replaced when the prompt is actually printed. You can read about what's available with the man page for bash (man bash) The man page is rather long, and you only need to see one particular section. So start a search by hitting a forward slash ( / ), type "PROMPTING" (should be all upper case), hit Enter/Return, and then press 'n' until you see the man page highlight the heading of the PROMPTING section. You'll see a list of all the codes you can use and what they expand to. If you use something that is not one of those codes, it's probably taken literally and printed verbatim in the prompt(like the open and close square braces in the example above).

To change your prompt, change the value it is assigned in one of two files.

Edit ~/.bash_profile to make the change only for one particular user.
Edit /etc/profile to make the change global for every user (each user can override this setting if they make a change in their personal ~/.bash_profile)

If you don't see any lines where PS1 is modified in the file you opened, then add these lines:
Code:
PS1='your custom string here'
export PS1
Otherwise, just substitute your customized value for whatever was there to begin with.

Save the file, and the next time you log in, your prompt should be what you set it to.

You can test it before adding to the file by executing:
Code:
export PS1='your custom string here'

Last edited by Dark_Helmet; 01-22-2005 at 02:59 AM.
 
Old 01-22-2005, 11:05 AM   #3
perryub
Member
 
Registered: Apr 2004
Location: Ontario, Canada
Distribution: Ubuntu Hoary
Posts: 45

Rep: Reputation: 15
Re: newbie :(

Quote:
Originally posted by Lance56
Hey on the command line it says
[lance@localhost lance]$

and i was wondering how i can change that
i know the first word is the "user", i just figured that out, i changed it awhile ago
now it's
[retro@localhost lance]$

i was wondering what the last word means and how i can edit/change it
Lance,

basically, it's "username@machine-name directory". For example, when I first open a shell, I get:

[perry@localhost perry]$

This is because my username is perry, my machine name is localhost and I am in the /home/perry/ directory. If I type cd /etc/ to get to the /etc/ directory, it displays:

[perry@localhost etc]$

Hope that helps,

Perry
 
  


Reply


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
security newbie, but not Linux newbie. advice on secure delete tools mattie_linux Linux - Security 19 08-15-2005 02:50 AM
Linux semi-newbie and Wine vary newbie geovolt_os1 Linux - Software 4 04-19-2005 12:03 PM
newbie;I am a linux newbie who has installed slackware and have run into a few proble MollyJolly Slackware - Installation 6 06-01-2004 12:21 PM
How To Update To Slackware-Current For a Newbie, By a Newbie :) windsok Slackware 1 09-18-2003 09:53 PM
ipchains newbie. Kernel newbie skeletal29 Linux - Security 3 06-02-2002 04:30 AM


All times are GMT -5. The time now is 08:40 PM.

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