LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-22-2010, 02:37 AM   #1
t1nm@n
Member
 
Registered: Aug 2009
Location: Trivandrum, Kerala, India.
Distribution: Lubuntu 14.04
Posts: 93
Blog Entries: 3

Rep: Reputation: 17
A tweak for terminal prompt


Hello , if u guys are usibg debaian or its derivative we can tweak out the terminal prompt. For example:
Quote:
ubuntu@ubuntu~#
If you are interested in tweaking. open up the .bashrc file in your home directory and add these lines
Quote:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]: ←֓
\[\033[01;34m\]\w\[\033[00m\]\$ '
←֓ replace this with :-) or any other thingy u can think of. 34 represents colour, in our case it is red. The result will be
Quote:
ubuntu@ubuntu: :-)
~$
this was seen in a book i read. if u have any doubt at all please post. i'm stll thinking of how i can remove the line saying "ubuntu@ubuntu" and just have "~$" at the prompt.
Have fun.

tinman.
 
Old 03-22-2010, 09:19 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Just a note - prompt customisation is not restricted to Debian and co. .. it will work with any bash:

color prompt example:
Code:
#------------------------------------------------------------------------
# ISO 6429 character sequences for colors etc
lc='\[\e[1;'
# foregrounds----backgrounds--------------------------------------------------
BLACK=${lc}30m;  B_BLACK=${lc}40m
RED=${lc}31m;    B_RED=${lc}41m
GREEN=${lc}32m;  B_GREEN=${lc}42m
YELLOW=${lc}33m; B_YELLOW=${lc}43m
BLUE=${lc}34m;   B_BLUE=${lc}44m
PURPLE=${lc}35m; B_PURPLE=${lc}45m
CYAN=${lc}36m;   B_CYAN=${lc}46m
WHITE=${lc}37m;  B_WHITE=${lc}47m
#------------------------------------------------------------------
BRIGHT=${lc}1m
UNDER=${lc}4m
FLASH=${lc}5m
RC=${lc}0m  # reset character
SEP="\\\$"  # separator
#------------------------------------------------------------------------
if [ "x${LOGNAME}" = "x" ]
then
  LOGNAME=$(whoami)
fi

# set pc, the prompt color
if [ "$USER" = "root" ]
then
  pc=$RED
else
  pc=$PURPLE
fi
#------------------------------------------------------------------------

# set the prompt
if [ $TERM  = "dumb" ]
then
  # no color if a dumb terminal
  pc=""; RC=""
fi

PS1="${pc}\]\u@\h \W\\$ ${RC}\]"
#PS1="${pc}\][\u@\h \w]$SEP${RC} "
#------------------------------------------------------------------------

cheers
 
Old 04-05-2010, 12:18 PM   #3
t1nm@n
Member
 
Registered: Aug 2009
Location: Trivandrum, Kerala, India.
Distribution: Lubuntu 14.04
Posts: 93
Blog Entries: 3

Original Poster
Rep: Reputation: 17
cool thanks for the info
 
  


Reply

Tags
terminal


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
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
How can I change the terminal prompt? ICO Slackware 4 02-15-2004 08:09 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


All times are GMT -5. The time now is 08:21 AM.

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