LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   terminal prompt different from console prompt (http://www.linuxquestions.org/questions/slackware-14/terminal-prompt-different-from-console-prompt-798622/)

dh2k 03-29-2010 06:07 AM

terminal prompt different from console prompt
 
In a GUI my bash terminal (terminal, xfterm4, xterm, konsole etc) show the CLI prompt as:
Code:

bash-3.1#

In a console terminal (init 3), terminal prompt shows as:
Code:

USER@Slackware$:
How do I start a terminal in GUI with the same prompt as (init 3)?


Also, if I 'su' to root then how do I change the dollar symbol to a hash symbol?
Code:

USER@Slackware$:
to
Code:

root@Slackware#:
NB. I am using fluxbox and I am starting GUI terminals from either 'run' dialogue prompt or from within another terminal or from right click > menu etc.

sycamorex 03-29-2010 06:12 AM

You can add:
Code:

. /etc/profile
to your .bashrc

GrapefruiTgirl 03-29-2010 06:15 AM

The console terminals are by default "login shells" which means that the /etc/profile file gets sourced. This file configures a number of things, including the prompt. It also sources other file(s) such as maybe a ~/.profile file if it exists.

To see how this works, open your GUI terminal and type:

Code:

. /etc/profile
don't forget the leading period! This should change your prompt to one like the one in the virtual console.
To have this happen when you open a GUI terminal, there are a number of ways, including setting your GUI terminal up to start as a login shell.

As for the $ vs the # symbols: by default, bash (and perhaps other shells) use the # to indicate root, and the $ to indicate non-root users. If you su to root, you should automatically get the # symbol, unless the root prompt is configured differently in /etc/profile or /root/.profile

Sasha

mohit052 03-29-2010 07:30 AM

/etc/passwd
 
hi all would not changing entries in shell entries in /etc/passwd do the tricks for the concerned users ?

sycamorex 03-29-2010 07:59 AM

Quote:

Originally Posted by mohit052 (Post 3916629)
hi all would not changing entries in shell entries in /etc/passwd do the tricks for the concerned users ?

I have no idea, however, sourcing /etc/profile does not require root rights and every user could do it on their own.

GrapefruiTgirl 03-29-2010 04:38 PM

Quote:

Originally Posted by mohit052 (Post 3916629)
hi all would not changing entries in shell entries in /etc/passwd do the tricks for the concerned users ?

Changing the shell entry may set a different shell for the user. However, the shell prompts are STILL configured in one or more of the profile files such as /etc/profile and/or ~/.profile and/or the user's local shell configuration file (like ~/.bash_profile or ~/.bashrc)

Inside /etc/profile, the code checks to see what shell is in use (what shell called the file) and sets a prompt accordingly.


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