修改终端的hostName

来源:互联网 发布:做淘宝货源哪里找 编辑:程序博客网 时间:2024/06/06 01:17

mac环境

1、cd ~

2、vi .bash_profile

如下配置:

export PS1="[\u@\h \W]\$ "


说明:

\u – 当前用户名

\h – 主机名hostname

\W – 当前目录

\w – 当前目录的完整路径

\d – 现在的系统日期

\t – 现在的系统时间

3、source .bash_profile


RedHat环境

vim ~/.bashrc

export PS1="[\u@\h \W]\$ "



Ubuntu环境

vim ~/.bashrc

找到这句

# If this is an xterm set the title to user@host:dir
case "$TERM" in

xterm*|rxvt*)

    #PS1="

\e]0;$debianchroot:+($debianchroot)\u@\h:\w\a
$PS1"

    PS1="[\u@\h \W]\$ "

    ;;
*)
    ;;

esac

将红色那句用#注掉,加上蓝色那句。