การปรับแต่งสีตัวอักษร บนเทอมินัล และพื้นหลังบนเทอมินัล

มกราคม 6, 2012

เปิด Terminal ขึ้นมา Alt+Ctrl+T

Type : “gedit .bashrc”


$ gedit .bashrc
พิมพ์
export PS1="\e[0;31m[\u@\h \W]\$ \e[m"

ไว้ท้ายสุด

Save and close the file.

แล้วตรวจสอบด้วยการเปิด Terminal อีกครั้งนึง

tput command

You can also use tput command. For example display RED prompt use tput as follows:
export PS1="\[$(tput setaf 1)\]\u@\h:\w $ \[$(tput sgr0)\]"

handy tput commands

  • tput bold – Bold effect
  • tput rev – Display inverse colors
  • tput sgr0 – Reset everything
  • tput setaf {CODE}- Set foreground color, see color {CODE} below
  • tput setab {CODE}- Set background color, see color {CODE} below

Colors {code} code for tput command

Color {code} Color
0 Black
1 Red
2 Green
3 Yellow
4 Blue
5 Magenta
6 Cyan
7 White

ผลลัพธ์ ที่ได้  ปรับให้คล้าย กับ Mint12 Terminal จะได้เป็น

credit: http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/


Follow

Get every new post delivered to your Inbox.