linux终端设置只显示当前目录及终端美化,linux当前目录


1.只显示当前目录

vim ~/.bashrc

找到位置:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

将这两个小写的w换成大写W,然后source ~/.bashrc即可


2.终端颜色美化

vim ~/.bashrc 然后下面这行的注释去掉,打开这个变量的开关,即可使用彩色的命令行提示符

# force_color_prompt=yes

 

关闭force_color_prompt的的效果如下图:

 

 而打开后的效果如下图:

 

另外,可以自定义PS1的颜色等信息,例如:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[0;34m\]@\[\033[0;35m\]\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '

 效果如下:

 

更多设置可以参考下面的链接:

Linux终端下输出彩色文字 http://www.linuxboy.net/Linux/2011-08/41473.htm
Linux 终端下颜色的输出[图文] http://www.linuxboy.net/Linux/2009-03/18792.htm
Ubuntu Linux终端美化 http://www.linuxboy.net/Linux/2012-07/65520.htm

 

相关内容

    暂无相关文章