LinuxQuestions.org
Review your favorite Linux distribution.
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 09-29-2011, 07:40 AM   #1
soundie
LQ Newbie
 
Registered: Sep 2011
Location: Jesi, Ancona, Italy
Distribution: OpenSuSE 11.4-KDE
Posts: 5

Rep: Reputation: Disabled
Smile customizing the prompt


Hi guys,
I'm interested in modifying my gnome-terminal prompt, and I'm reading the ''Bash prompt How to'' from TheLinuxDocumentationProject.
How and where can I take the VGA font rpm for my emulator terminal in Centos 6?

thanks
 
Old 09-29-2011, 08:08 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Salve and Welcome to LQ,
This may help you.
I'm not sure if this font is still available.
ciao,
jdk
 
1 members found this post helpful.
Old 09-29-2011, 08:24 AM   #3
soundie
LQ Newbie
 
Registered: Sep 2011
Location: Jesi, Ancona, Italy
Distribution: OpenSuSE 11.4-KDE
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jdkaye View Post
Salve and Welcome to LQ,
This may help you.
I'm not sure if this font is still available.
ciao,
jdk
Thanks jdk!
I thought, reading in internet, this font is obsolete...so what font do you advise me to have a more cool and friendly prompt?
 
Old 09-29-2011, 08:31 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
I am a nonno but I admit to being totally cool and friendly.
Have a look in /usr/share/consolefonts/ if that's where they're kept in CentOS
This guy has some ideas. Check it out. If you find something cool you can tell us.
ciao,
jdk
 
1 members found this post helpful.
Old 09-29-2011, 09:01 AM   #5
soundie
LQ Newbie
 
Registered: Sep 2011
Location: Jesi, Ancona, Italy
Distribution: OpenSuSE 11.4-KDE
Posts: 5

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by jdkaye View Post
I am a nonno but I admit to being totally cool and friendly.
Have a look in /usr/share/consolefonts/ if that's where they're kept in CentOS
This guy has some ideas. Check it out. If you find something cool you can tell us.
ciao,
jdk
Ok! Thanks jdk!
 
Old 09-29-2011, 10:05 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 18,345

Rep: Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910Reputation: 3910
Quote:
Originally Posted by soundie View Post
Ok! Thanks jdk!
And I'll chime in too. I use yakuake, so it's easy to set other fonts. But I do customize my prompt. Try putting these into your .bashrc:
Code:
PS1="\[\033[1;36m\][\u@\[\033[1;37m\]\h:\[\033[1;33m\]\w]\\$\[\033[0m\] "
SUDO_PS1="\[\033[1;31m\][\u@\[\033[1;37m\]\h:\[\033[1;33m\]\w]\\$\[\033[0m\] "
Hideous, I know. But, turns out pretty good. The standard PS1 prompt will be like this:
Code:
[user@hostname:directory]$
...and the prompt when you go into a SUDO shell "sudo -s" will be:
Code:
[user@hostname:directory]$
to give you a visual clue that you're running as root, and should be careful. Changing the second number (it's a 1;36m for regular, 1;31m for sudo in the above examples), will let you change the colors.
 
1 members found this post helpful.
Old 09-30-2011, 03:58 AM   #7
soundie
LQ Newbie
 
Registered: Sep 2011
Location: Jesi, Ancona, Italy
Distribution: OpenSuSE 11.4-KDE
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
And I'll chime in too. I use yakuake, so it's easy to set other fonts. But I do customize my prompt. Try putting these into your .bashrc:
Code:
PS1="\[\033[1;36m\][\u@\[\033[1;37m\]\h:\[\033[1;33m\]\w]\\$\[\033[0m\] "
SUDO_PS1="\[\033[1;31m\][\u@\[\033[1;37m\]\h:\[\033[1;33m\]\w]\\$\[\033[0m\] "
Hideous, I know. But, turns out pretty good. The standard PS1 prompt will be like this:
Code:
[user@hostname:directory]$
...and the prompt when you go into a SUDO shell "sudo -s" will be:
Code:
[user@hostname:directory]$
to give you a visual clue that you're running as root, and should be careful. Changing the second number (it's a 1;36m for regular, 1;31m for sudo in the above examples), will let you change the colors.

Hi TBOne
thanks for answering!!
I've already colored my prompt, but now I'd want to use some kind of special caracter like this '---' to create a sort of a 'futuristic architecture'...like this http://imagecdn.maketecheasier.com/2...hprompts-7.jpg , but in many linux documentation they talk about installing some special font (like VGA font but maybe it is very old) to visualize the exact escape sequencing...infact, if I use some of the prompt configuration posted in internet, I don't have the same result!
The problem is that I don't know what kind of font I need and how to use it (i'm trying to learn the art of scripting in shell, and maybe this will b my first ''serious'' script
 
Old 09-30-2011, 05:29 AM   #8
rhowaldt
LQ Newbie
 
Registered: Jun 2011
Location: Netherlands
Distribution: #! (crunchbang)
Posts: 5

Rep: Reputation: Disabled
not sure if this is what you are looking for, but those strange-looking lines and stuff are Extended ASCII (see here: http://www.cdrummond.qc.ca/cegep/inf...iles/ascii.htm). the Terminus-font should be able to render this i think.
 
Old 09-30-2011, 05:39 AM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You can customize your prompt with symbols from the Unicode table. To generate Unicode characters you have to use a terminal or an editor that support them. To type them, press simultaneously Ctrl-Shft-U, then type the code and press enter. The unicode character will appear, provided you have a font from which that character is available. Gnome-terminal and Firefox support this method.

In alternative you can open a VIM session, press I to enter in insert mode, then press Ctrl-V, then U, then the code and the character appears. You can copy and paste them in your PS1 assignment statement and the trick is done. For example I have the following statements in my .bashrc:
Code:
#
#    ┌─   is  u250C + u2500
#    └─   is  u2514 + u2500
#        is  u26AB
#    ▪    is  u25AA
#    ▸    is  u25B8
#
G='\033[0;30m' # black
N='\033[0;32m' # green
C='\033[0;36m' # cyan
R='\033[0;31m' # red
W='\033[0m'    # default
B='\033[0;37m' # white
if tty | grep -q tty
then
  export PS1="\[$W\]┌─[\[$N\]\u\[$W\]@\[$C\]\h\[$W\]]-[\[$R\]\W\[$W\]]\n└─ \[$W\]"
else
  export PS1="\[$G\]┌─[\[$N\]\u\[$G\]@\[$C\]\h\[$G\]]-[\[$R\]\W\[$G\]]\n└─ \[$W\]"
fi
The tty part checks if I am in a Virtual Console (text mode) or in a Pseudo Terminal and change the colours accordingly, since my VC has a black background whereas my terminal is white. The prompt appears like this:
Code:
┌─[colucix@ocean-4]-[~]
└─
 
1 members found this post helpful.
Old 09-30-2011, 05:50 AM   #10
soundie
LQ Newbie
 
Registered: Sep 2011
Location: Jesi, Ancona, Italy
Distribution: OpenSuSE 11.4-KDE
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
You can customize your prompt with symbols from the Unicode table. To generate Unicode characters you have to use a terminal or an editor that support them. To type them, press simultaneously Ctrl-Shft-U, then type the code and press enter. The unicode character will appear, provided you have a font from which that character is available. Gnome-terminal and Firefox support this method.

In alternative you can open a VIM session, press I to enter in insert mode, then press Ctrl-V, then U, then the code and the character appears. You can copy and paste them in your PS1 assignment statement and the trick is done. For example I have the following statements in my .bashrc:
Code:
#
#    ┌─   is  u250C + u2500
#    └─   is  u2514 + u2500
#        is  u26AB
#    ▪    is  u25AA
#    ▸    is  u25B8
#
G='\033[0;30m' # black
N='\033[0;32m' # green
C='\033[0;36m' # cyan
R='\033[0;31m' # red
W='\033[0m'    # default
B='\033[0;37m' # white
if tty | grep -q tty
then
  export PS1="\[$W\]┌─[\[$N\]\u\[$W\]@\[$C\]\h\[$W\]]-[\[$R\]\W\[$W\]]\n└─ \[$W\]"
else
  export PS1="\[$G\]┌─[\[$N\]\u\[$G\]@\[$C\]\h\[$G\]]-[\[$R\]\W\[$G\]]\n└─ \[$W\]"
fi
The tty part checks if I am in a Virtual Console (text mode) or in a Pseudo Terminal and change the colours accordingly, since my VC has a black background whereas my terminal is white. The prompt appears like this:
Code:
┌─[colucix@ocean-4]-[~]
└─

Thanks colucix, this is what I'm looking for!!
Have a nice day!
 
Old 09-30-2011, 06:02 AM   #11
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You're welcome!
 
  


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
[SOLVED] Help Customizing Terminal prompt EzioAuditore Linux - Newbie 18 04-07-2011 01:28 PM
terminal prompt different from console prompt dh2k Slackware 5 03-29-2010 05:38 PM
passing parameters from a unix shell prompt into a windows cmd.exe prompt nano2 Programming 1 09-01-2009 12:26 PM
Customizing the command prompt sweetnsourbkr Linux - General 4 11-10-2005 01:34 PM
customizing bash prompt? sunshine Mandriva 1 03-08-2004 10:18 PM


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