Some people will be bored looking at colorless terminal as i usually look. I do 50% of my laptop by using my terminal(CLI) on my Ubuntu 7.10 Gutsy Gibbon. I used to use bash shell a few weeks ago and bash do have some coloring on the shell, but still a lil bit boring.
But recently I change myself to zsh shell to do more shell programming. It's not the best shell for script/programming, but I get/read a lot of feedback from other linux user that this shell is suitable for shell scripting/programming.
So I this is simple tutorial on how to color your terminal to your need and make it a litle bit interesting to look at, so maybe you can spend more time to do you programming :P
First of all, you need to know the color code for shell, here is the list:
- Choices : red, green, yellow, blue, magenta, cyan and white. The color codes for this are 30 (black), 31(red), 32 (green), 33 (yellow), 34 (blue), 35 ( magenta), 36 (cyan), 37 (white).
- touch ~/.zshrc
- nano ~/.bashrc
- for prompt option you just need to add "PROMPT=" command inside .zshrc but if you would like to make some differences, you can try to do it on the right side by using this "RPROMPT="
- here is some variable which will be recognized by shell: (%n)Username , (%B , %b)Bold text, (%~)Current Directory, (%U , %u)Underline, (%m)Machine name, (%h)Number of shell's history, (%t)Time and etc.
- For coloring you have to use this %{\e[0;31m%} , and by changing number "31" you can change the color by the code given earlier.
- So here is a simple example to create your prompt: paste this inside your .zshrc
- PROMPT=$'%{\e[0;32m%}%UTell zsh what to do!%u %{\e[0m%}'
- Save and exit.
- Restart your terminal and you will see your prompt changing to :
- Tell zsh what to do!
- So you can try yourself to color up your terminal shell by writing your own .zshrc ~!
Thank you for your unbelievable support on Negative Zero - Permission to read and write blog for nearly 4 years. Don't forget to like Negative Zero on Facebook.
Uhh, dude. "nano ~/.bashrc" is _not_ how you edit the .zshrc file. I think you meant "nano ~/.zshrc"
ReplyDelete