LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-10-2008, 04:46 PM   #1
yusufs
Member
 
Registered: Oct 2007
Posts: 162

Rep: Reputation: 30
user login prompt


Hai all,


After creating any user normally after the logins .. the propmt will be like :


[applinst@oracle7 )

username@hostname


But , today after creating one user and when I login it became :

prompt for any new user is :

-bash-3.00$


what is the reason for this.. I need to access the user .bash_profile for storing one environmental file..

anyclue what is the reason and how I can overcome this ?


Yusuf
 
Old 03-10-2008, 05:16 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,793

Rep: Reputation: 292Reputation: 292Reputation: 292
You configure the bash prompt by the PS1 variable. You can set the prompt to hello with PS1=hello. This is explained in the bash man page under the PROMPT_COMMAND section.

You can make the prompt more elaborate by using escape characters and variables in PS1, for example:

PS1=$HOME

will change the prompt to the name of your home directory. Use the command:

printenv

to see other variables that you could possibly use. Other things that you can include in your prompt are described in the bash man page under PROMPTING. For example:

PS1="\u@$HOME"

Once you get PS1 the way that you want it you can make it permanent by placing it in a bash profile file under /home/user/. Different distributions use different bash profile files. Look for .bashrc, .bash_profile, or .profile.

As to why PS1 was set up differently the latest time you added a user, I don't know. Maybe you used a different command to set up the user and the commands have different default values for PS1. Did you do one user with the useradd command and another user with your distribution setup software?

--------------------
Steve Stites
 
Old 03-10-2008, 10:28 PM   #3
felixc
Member
 
Registered: Jul 2005
Distribution: Debian
Posts: 94

Rep: Reputation: Disabled
You may be able to find the default .bashrc and .profile files for new users under /etc/skel. If so, you can set whatever options you like in these skeleton files, and they will be copied to new users' home directories upon creation.

For existing users, see the reply above mine!
 
Old 03-10-2008, 11:00 PM   #4
Slokunshialgo
Member
 
Registered: Jan 2006
Distribution: Ubuntu 9.04, Fedora 10
Posts: 76

Rep: Reputation: 17
If you want to customize your prompt, might I recommend reading this article to see what you can do.

The colours for this are a little outdated, but still good on a black-background. Here's the line I put in my .bashrc file:

export PS1='\n\[\e[32m\][\u@\h, \d \[\e[31m\]\w\[\e[32m]\]\n\t \$ \[\e[0m\]'

As for how your prompt changed, it looks like maybe your /etc/profile file went missing...
 
Old 03-11-2008, 06:30 AM   #5
yusufs
Member
 
Registered: Oct 2007
Posts: 162

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Slokunshialgo View Post
If you want to customize your prompt, might I recommend reading this article to see what you can do.

The colours for this are a little outdated, but still good on a black-background. Here's the line I put in my .bashrc file:

export PS1='\n\[\e[32m\][\u@\h, \d \[\e[31m\]\w\[\e[32m]\]\n\t \$ \[\e[0m\]'

As for how your prompt changed, it looks like maybe your /etc/profile file went missing...
Thanks Jailbait,Felixc, slokunshialgo for your answers.. that really helped me



Yusuf
 
  


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
vsftpd login locally, but not remotely. get a login prompt though! ajkett Linux - Server 0 02-22-2007 05:18 AM
how can I customise my login to avoid prompt for user and password? krmane Slackware 6 07-13-2006 11:35 AM
Prompt user for information immediately after login? bpottle Linux - Software 1 05-31-2006 10:59 AM
add user prompt for password on login redir Linux - Newbie 2 02-28-2005 12:01 PM
how to issue a message prior to login prompt for a particular user mtest Programming 19 10-30-2003 07:41 AM


All times are GMT -5. The time now is 05:13 AM.

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