還是在.bashrc
需求是: 希望在一般user和root的提示符號顏色不同,並且不要提示一大串user@ubuntu等hostname什麼的。
1. unmark "force_color_prompt=yes"
2.
if [ "$color_prompt" = yes ]; then
//original
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
//修改過後: h就是ubuntu,32m什麼的是terminal的顏色設定代碼
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
這樣就乾淨多了,可以在user和root的.bashrc內分別設定不同的顏色
附上代碼表:
30: Black/Dark grey
31: Red
32: Green
33: Yellow
34: Blue
35: Magenta
36: Fuscia
37: White/light grey
38: "Default" foreground color
附註:更改hostname的方法:
1. hostname -v new_name
2. vi /etc/hosts
change to 127.0.0.1 new_name
3. 永久改變hostname==> vi /etc/hostname
4. 改完後,restart network ==> /etc/init.c/networking restart
才不會出現unable to resolve.......
留言列表