Showing posts with label prompt. Show all posts
Showing posts with label prompt. Show all posts

Saturday, August 30, 2008

Customize Your Terminal Prompt


Okay so after a short time the plain white/white layout for a terminal is kind of lame and boring, so what say we spice it up a bit?
We are going to take a second to check out a file you can find in your Home (/home/your-username/) folder. The file we are looking for is named '.bashrc' (notice the period before the 'b'), so if you have the Mousepad text editor installed you can just type in the terminal:

sudo mousepad ~/.bashrc

And you see the file, make a back-up so if you mess up you can always go back. Now scroll down until you see a line similar to this (it should be somewhere near the bottom):

PS1="\[\033[0;36m\]\A\[\033[0;35m\]\u@\h:\w$ "


note: Your's will probably look different

Now this probably looks like gibberish to the average newbie, but I'm going to make it deadly simple for you without going in to the nasty details of escape sequences and BASH programming. Basically what we want to do it tell the computer that we want our prompt to be all colorful and pretty, so first lets decide on what colors we want, here is a list of some escape sequences and their colors.

Red = "\[\033[0;31;40m\]"
Green = "\[\033[0;32;40m\]"
Grey = "\[\033[0;37;40m\]"
Black = "\[\033[0;30;40m\]"
Yellow = "\[\033[0;33;40m\]"
Blue = "\[\033[0;34;40m\]"
Magenta = "\[\033[0;35;40m\]"
Cyan = "\[\033[0;36;40m\]"
White = "\033[0;37;40m"

So now what do we do with all these wonderful gibberish codes? well, see in that line in the .bashrc file somewhere it says "\u", "\h" and "\w"? Well,

\u = Username
\h = Hostname
\w = Workspace

So all we have to do is place our chosen color-escape-code infront of one of these, e.g. placing "\[\033[0;37;40m\]" in front of "\h" would change everything after the "\[\033[0;37;40m\]" to white text (so remember at the end of the gibberish to put in whatever color code you want your commands to appear in!).
Here is an example of a funky prompt:

PS1="
\[\033[0;37m\][
\[\[\033[0;36m\]\A
\[\033[0;35m\]\u \[\033[0;31m\]@ \[\033[0;34m\]\h \[\033[0;37m\]] \[\033[0;32m\]\w \[\033[0;37m\]\n$ "
(it's been split over multiple lines for readability reasons)

Enjoy!


Kiefer

Tuesday, August 26, 2008

P2P Madness!

Alright guys, Just a quick note to let you all know about FrostWire - The Linux equivalent of LimeWire, so head over to http://www.frostwire.com and check it out, its only flaw (in my opinion anyway) is that it's written in Java, which can be incredibly slow on older systems, so keep that in mind and may the P2P be with you!

P.s: Guys, new computer in a week or so, I'm going to be switching distro - still deciding which, friends have nudged me towards Arch Linux, checking out Gentoo right now, I'll keep you updated!