LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   user login prompt (https://www.linuxquestions.org/questions/linux-newbie-8/user-login-prompt-627054/)

yusufs 03-10-2008 03:46 PM

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

jailbait 03-10-2008 04:16 PM

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

felixc 03-10-2008 09:28 PM

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! :)

Slokunshialgo 03-10-2008 10:00 PM

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...

yusufs 03-11-2008 05:30 AM

Quote:

Originally Posted by Slokunshialgo (Post 3084573)
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


All times are GMT -5. The time now is 08:07 AM.