Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
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
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.
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
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.
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:
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.