终端@前面为用户名,@后面为主机名
1 修改主机名字
sudo gedit /etc/hosts
- 直接更改第二行的xxx为自己想要的
127.0.0.1 localhost
127.0.1.1 xxx
The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
- 重启hosts文件
sudo /etc/init.d/networking restart
2 修改用户名
gedit ~/.bashrc
- 找到PS1部分
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]aaaaa@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\aaaaa@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}aaaaa@\h: \w\a\]$PS1"
;;
*)
;;
esac
- 把aaaaa部分换成自己想要的名字后保存
- source ~/.bashrc