我是喜欢使用终端机的人之一。 我认为 GNU / Linux的 在某一时刻,他们不能没有它,因为那满是字母的窗口使生活变得更加轻松,对吗?
但是我们可以使它看起来比默认值更漂亮。 可以从以下位置查看(并下载)此示例 侏儒神色。 我将在下面向您显示的提示是使我们的终端具有以下外观:
如您所见, 执行命令 并放在每个订单之间 时间线 随着系统时间。
我该怎么做?
我们打开一个文本编辑器 (例 gedit中) 然后将其放入其中:
# Fill with minuses
# (this is recalculated every time the prompt is shown in function prompt_command):
fill="--- "
reset_style='\[\033[00m\]'
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
prompt_style=$reset_style
command_style=$reset_style'\[\033[1;29m\]' # bold black
# Prompt variable:
PS1="$status_style"'$fill \t\n'"$prompt_style"'${debian_chroot:+($debian_chroot)}\u@\h:\w\$'"$command_style "
# Reset color for command output
# (this one is invoked every time before a command is executed):
trap 'echo -ne "\e[0m"' DEBUG
function prompt_command {
# create a $fill of all screen width minus the time string and a space:
let fillsize=${COLUMNS}-9
fill=""
while [ "$fillsize" -gt "0" ]
do
fill="-${fill}" # fill with underscores to work on
let fillsize=${fillsize}-1
done
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
bname=`basename "${PWD/$HOME/~}"`
echo -ne "\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"
;;
*)
;;
esac
}
PROMPT_COMMAND=prompt_command
我们将其保留在我们的内部 /主页 名称 .bash_ps2 例如。 然后我们打开 的.bashrc 并且我们添加:
if [ -f "$HOME/.bash_ps2" ]; then
. "$HOME/.bash_ps2"
fi
我们打开一个终端,我们可以看到变化
出现在: 人类.
