Linux 配置技巧
时间:2010-08-06 来源:tacoe
1 1.去掉终端显示的绝对路径.
2 如果当前目录处于比较深的时候,在提示符前显示了绝对路径后,右边的宽度就很小了,
3 这样对于执行长的命令就会分成两行,看起来很麻烦,不够直观.再加上在端的标题栏上
4 已经有绝对数径,再在提示符下显示是多此一举,资源浪费.
5 打开~/.bashrc 文件
6 if [ "$color_prompt" = yes ]; then
7 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
8 else
9 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
10 fi
11 unset color_prompt force_color_prompt
12
13 # If this is an xterm set the title to user@host:dir
14 case "$TERM" in
15 xterm*|rxvt*)
16 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
17 ;;
18 *)
19 ;;
20 esac
21 上图中的PS1就是定义终端提示符的,其中\W应该就是表示工作目录.把它去掉就可以.
22 其实我们可以修改PS1变量就可以自定义自己想要的提示符.其中[]定义的是字符的前景
23 色后后景色.
24 好,去掉后第9行的\w后,我的终端提示成了:
25 taco@taco-laptop$
26 再也不用看到那长长的绝对路径提示了.
27
2 如果当前目录处于比较深的时候,在提示符前显示了绝对路径后,右边的宽度就很小了,
3 这样对于执行长的命令就会分成两行,看起来很麻烦,不够直观.再加上在端的标题栏上
4 已经有绝对数径,再在提示符下显示是多此一举,资源浪费.
5 打开~/.bashrc 文件
6 if [ "$color_prompt" = yes ]; then
7 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
8 else
9 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
10 fi
11 unset color_prompt force_color_prompt
12
13 # If this is an xterm set the title to user@host:dir
14 case "$TERM" in
15 xterm*|rxvt*)
16 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
17 ;;
18 *)
19 ;;
20 esac
21 上图中的PS1就是定义终端提示符的,其中\W应该就是表示工作目录.把它去掉就可以.
22 其实我们可以修改PS1变量就可以自定义自己想要的提示符.其中[]定义的是字符的前景
23 色后后景色.
24 好,去掉后第9行的\w后,我的终端提示成了:
25 taco@taco-laptop$
26 再也不用看到那长长的绝对路径提示了.
27
相关阅读 更多 +