LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-19-2013, 07:57 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
shell prompt


when I use the command su , it will get to the shell , but the root sign is as below

root@user1-desktop:~#

can advise if I want to change the sign to # as below , what can I do ? thanks

#
 
Old 04-19-2013, 08:08 AM   #2
eggshell
LQ Newbie
 
Registered: Jan 2012
Posts: 11

Rep: Reputation: Disabled
When you are changing to the route user are you using the following command: su - or su

su - changing your user to root but also takes you to the root home directory and loads all root user system paths

you can move to the home directory of any user by using the following command: cd ~

Hope this info helps
 
Old 04-19-2013, 08:25 AM   #3
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
Misunderstood the question... Sorry about that.

Last edited by grim76; 04-19-2013 at 09:38 AM. Reason: Entry not relevant to question.
 
Old 04-19-2013, 08:28 AM   #4
Nbiser
Member
 
Registered: Oct 2012
Location: Maryland
Distribution: Fedora, Slackware, Debian, Ubuntu, Knoppix, Helix,
Posts: 302
Blog Entries: 7

Rep: Reputation: 44
I don't think that there is any way to change the symbol in the terminal prompt. I think that the default prompt is your only option. However, you might want to contact the maker of distribution, if anyone knows, they do.
 
Old 04-19-2013, 08:29 AM   #5
Philip Lacroix
Member
 
Registered: Jun 2012
Distribution: Slackware{,-current}, OpenBSD
Posts: 377

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi,

in order to change the (bash) shell prompt, in Debian you can edit /etc/bash.bashrc and modify the PS1 variable like this:

Code:
PS1='${debian_chroot:+(debian_chroot)}# '
In general, this should also work:

Code:
PS1='# '
Otherwise, modifying PS1 in /etc/profile will affect other shells as well, but at least in Debian the value is taken from /etc/bash.bashrc anyway.

Both files will change the prompt system-wide, but will be overridden if PS1 is set differently in /home/<user>/.bashrc.

EDIT: For user-specific settings .bashrc is the file you want to edit. This is valid for /root/.bashrc as well, which AFAIK is the best way to go if you wish to affect the root prompt and nothing else.

Kind regards,

Philip

Last edited by Philip Lacroix; 04-19-2013 at 09:16 AM.
 
Old 04-19-2013, 08:32 AM   #6
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian, Arch
Posts: 1,161
Blog Entries: 7

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
Each shell may have it's own way of changing the prompt. If you're using bash, and just want the hash alone as your prompt:
Code:
export PS1=#
To make it persistent, you will have to edit a configuration file, .bash_profile for bash.

Last edited by goumba; 04-19-2013 at 10:59 AM. Reason: looks like I was a bit late
 
Old 04-22-2013, 11:55 AM   #7
Philip Lacroix
Member
 
Registered: Jun 2012
Distribution: Slackware{,-current}, OpenBSD
Posts: 377

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Regarding ~/.bash_profile in Debian, I'm slightly confused. It used to be the configuration file for login shells, and it still is according to the bash man page:

Code:
/etc/profile
     The systemwide initialization file, executed for login shells
/etc/bash.bashrc
     The systemwide per-interactive-shell startup file
~/.bash_profile
     The personal initialization file, executed for login shells
~/.bashrc
     The individual per-interactive-shell startup file
However, in Debian Squeeze (bash 4.1) and Wheezy (bash 4.2) I don't see any ~/.bash_profile, so I guess login shells are handled by /etc/profile by default. Besides, /etc/profile reads /etc/bash.bashrc (system-wide configuration for non-login shells) if it exists. With this setup, as far as I can see, ~/.bashrc affects login shells as well, unless ~/.bash_profile is available.

This is not valid for Slackware (and probably for many other distributions) where ~/.bashrc and ~/.bash_profile have their original behavior, while /etc/profile is for system-wide configuration affecting login shells. Moreover, /etc/bash.bashrc is not there and not even mentioned in the man page (while it is in Debian's version), so I guess this file is a Debian "fix"?

Kind regards,

Philip

Last edited by Philip Lacroix; 04-22-2013 at 04:46 PM.
 
Old 04-22-2013, 08:40 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,371

Rep: Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381Reputation: 2381
The files under /etc are read first, then the user's personal files, which can override the global settings.
You may have to create the local/personal bash files.
 
1 members found this post helpful.
Old 04-23-2013, 06:23 AM   #9
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian, Arch
Posts: 1,161
Blog Entries: 7

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
Quote:
Originally Posted by Philip Lacroix View Post
This is not valid for Slackware (and probably for many other distributions) where ~/.bashrc and ~/.bash_profile have their original behavior, while /etc/profile is for system-wide configuration affecting login shells. Moreover, /etc/bash.bashrc is not there and not even mentioned in the man page (while it is in Debian's version), so I guess this file is a Debian "fix"?

Yes, each distribution has its own idiosyncrasies. The bottom line is that a the lack of a file file, be it system wide or per-user, is silently ignored. At one time a per user startup file was probably included in /etc/skel so that each user had one upon creation, and it was later deemed unnecessary.
 
1 members found this post helpful.
Old 04-23-2013, 08:44 AM   #10
Philip Lacroix
Member
 
Registered: Jun 2012
Distribution: Slackware{,-current}, OpenBSD
Posts: 377

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Thank you, goumba and chrism01, for clarifying this point.

Quote:
Originally Posted by goumba View Post
At one time a per user startup file was probably included in /etc/skel so that each user had one upon creation.
Yes, I remember this was the case with Debian Sarge (3.1) for example, but I don't know exactly when the thing changed.

Best wishes,
Philip
 
Old 04-23-2013, 12:28 PM   #11
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 498

Rep: Reputation: 214Reputation: 214Reputation: 214
More information about changing the prompt can be found in the Bash Prompt HOWTO.
 
1 members found this post helpful.
  


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
How Does Your Shell Prompt Looks Like? devUnix Linux - General 15 03-02-2011 11:39 PM
shell prompt abhijeetdutta Linux - Server 3 04-22-2010 02:05 AM
passing parameters from a unix shell prompt into a windows cmd.exe prompt nano2 Programming 1 09-01-2009 11:26 AM
LXer: Shell tip: Set the shell prompt and themes in Linux Terminal LXer Syndicated Linux News 0 06-12-2007 03:02 AM
Shell Prompt xneowolf Linux - General 5 01-26-2003 02:06 AM


All times are GMT -5. The time now is 08:37 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