修改linux命令行的提示符PS1

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}\u@:\w:\#\$ '
# 各个参数含义如下:

\d :#代表日期,格式为weekday month date,例如:”Mon Aug 1” \H :#完整的主机名称 \h :#仅取主机的第一个名字 \T :#显示时间为24小时格式,如:HH:MM:SS \t :#显示时间为12小时格式 , 如:HH:MM:SS \A :#显示时间为12小时格式:HH:MM \u :#当前用户的账号名称 \v :#BASH的版本信息 \w :#完整的工作目录名称 \W :#利用basename取得工作目录名称,所以只会列出最后一个目录 \# :#表示下达的第几个命令 \$ :#提示字符,如果是root时,提示符为:# ,普通用户则为:$

猜你喜欢

转载自www.cnblogs.com/igoodful/p/11696545.html