LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-13-2001, 02:06 PM   #1
Stephanie
LQ Addict
 
Registered: May 2001
Location: Arizona
Distribution: 9.2 Mandy 1.4 Gentoo 5.1 FreeBSD WinXP
Posts: 1,166

Rep: Reputation: 45
BASH Console


This is similar to another post, but I have a questions that is just a tad different.

On the BASH, I get either a # or a $ sign, depedning on whether I log in as root or a user.

My questions is whether there is a way to change it to be something else for all logged in individuals, including root. If so, how do I go about changing it?
 
Old 07-13-2001, 03:31 PM   #2
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Have a look in /etc/profile for the definition of PS1 (your default prompt). You can make changes here. The details of all the special characters are below:
Quote:
Lifted from the bash man page
PROMPTING

When executing interactively, bash displays the primary
prompt PS1 when it is ready to read a command, and the
secondary prompt PS2 when it needs more input to complete
a command. Bash allows these prompt strings to be cus-
tomized by inserting a number of backslash-escaped special
characters that are decoded as follows:

\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format
(e.g., "Tue May 26")
\e an ASCII escape character (033)
\h the hostname up to the first `.'
\H the hostname
\j the number of jobs currently managed by the
shell
\l the basename of the shell's terminal device
name
\n newline
\r carriage return
\s the name of the shell, the basename of $0
(the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patchlevel
(e.g., 2.00.0)
\w the current working directory
\W the basename of the current working direc-
tory
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a
$
\nnn the character corresponding to the octal
number nnn
\\ a backslash
\[ begin a sequence of non-printing characters,
which could be used to embed a terminal con-
trol sequence into the prompt
\] end a sequence of non-printing characters

The command number and the history number are usually dif-
ferent: the history number of a command is its position in
the history list, which may include commands restored from
the history file (see HISTORY below), while the command
number is the position in the sequence of commands exe-
cuted during the current shell session. After the string
is decoded, it is expanded via parameter expansion, com-
mand substitution, arithmetic expansion, and quote
removal, subject to the value of the promptvars shell
option (see the description of the shopt command under
SHELL BUILTIN COMMANDS below).
As I like having a username@host style prompt I've changed mine to
Code:
PS1='\u@\h:\w\$ '
hence my prompts look something like
Code:
root@mnemosyne:~# cd /var/lib/apache/conf
root@mnemosyne:/var/lib/apache/conf# cd /var/spool/
root@mnemosyne:/var/spool# cd
Does that help??

cheers

Jamie...
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get a bash console on a home page??? ankur_linuxfan Linux - Software 6 07-17-2005 05:43 PM
10.1 - console & Bash High-gain Linux - Newbie 4 06-13-2005 03:46 PM
bash + manipulate stdout to console dave bean Programming 1 02-21-2005 06:44 AM
console like bash for windows biiiep General 3 07-16-2004 01:38 AM
Linux Console & Bash outsider Linux - Newbie 1 09-13-2001 03:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:59 PM.

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