LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 03-29-2010, 07:07 AM   #1
dh2k
Member
 
Registered: Jan 2006
Distribution: Slackware 13.0 (KDE 3.5.10 from 12.2; Xfce 4.6; Fluxbox); Slackware 13.1 (KDE 4.5)
Posts: 203

Rep: Reputation: 44
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.

Last edited by dh2k; 03-29-2010 at 07:10 AM.
 
Old 03-29-2010, 07:12 AM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,578
Blog Entries: 1

Rep: Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033
You can add:
Code:
. /etc/profile
to your .bashrc
 
Old 03-29-2010, 07:15 AM   #3
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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
 
Old 03-29-2010, 08:30 AM   #4
mohit052
LQ Newbie
 
Registered: Nov 2008
Posts: 25

Rep: Reputation: 15
/etc/passwd

hi all would not changing entries in shell entries in /etc/passwd do the tricks for the concerned users ?
 
Old 03-29-2010, 08:59 AM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,578
Blog Entries: 1

Rep: Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033Reputation: 1033
Quote:
Originally Posted by mohit052 View Post
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.
 
Old 03-29-2010, 05:38 PM   #6
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by mohit052 View Post
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.
 
  


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
passing parameters from a unix shell prompt into a windows cmd.exe prompt nano2 Programming 1 09-01-2009 12:26 PM
Terminal prompt goes away poriajay Linux - Newbie 1 05-21-2008 09:53 PM
cant get Terminal Prompt binay_gupta Linux - General 1 08-19-2006 08:18 AM
no prompt in terminal xyfan Linux - Newbie 1 12-06-2003 12:25 AM
terminal with no prompt fletch88 Red Hat 0 11-17-2003 01:45 AM


All times are GMT -5. The time now is 05:26 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration