LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 06: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: 211

Rep: Reputation: 52
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 06:10 AM.
 
Old 03-29-2010, 06:12 AM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

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

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
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, 07: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, 07:59 AM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
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, 04:38 PM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
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



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 11:26 AM
Terminal prompt goes away poriajay Linux - Newbie 1 05-21-2008 08:53 PM
cant get Terminal Prompt binay_gupta Linux - General 1 08-19-2006 07:18 AM
no prompt in terminal xyfan Linux - Newbie 1 12-05-2003 11:25 PM
terminal with no prompt fletch88 Red Hat 0 11-17-2003 12:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:08 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
Open Source Consulting | Domain Registration