Linux shell PS1设置
来源:互联网 发布:前端 后端 知乎 编辑:程序博客网 时间:2024/05/01 12:32
Linux的命令提示符的格式是由系统变量PS1和PS2来定义的。
When executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the
secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be cus-
tomized by inserting a number of backslash-escaped special characters that are decoded as follows:
\a an ASCII bell character (07)
\d the date in "Weekday Month Date" format (e.g., "Tue May 26")
\D{format}
the format is passed to strftime(3) and the result is inserted into the prompt string; an empty
format results in a locale-specific time representation. The braces are required
\e an ASCII escape character (033)
\h the hostname up to the first ‘.’
\H the hostname
\j the number of jobs currently managed by the shell
\l the basename of the shell’s terminal device name
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\A the current time in 24-hour HH:MM format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patch level (e.g., 2.00.0)
\w the current working directory, with $HOME abbreviated with a tilde
\W the basename of the current working directory, with $HOME abbreviated with a tilde
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number nnn
\\ a backslash
\[ begin a sequence of non-printing characters, which could be used to embed a terminal control
sequence into the prompt
\] end a sequence of non-printing characters
-bash-3.2$
-bash-3.2$
-bash-3.2$ PS1='[\u@\h \W]$'
[carl.shen@cvs ~]$
[carl.shen@cvs ~]$
GROUP=`id -gn`
if [ "$USER" = "root" ]; then
PS1='[\[\e[31;1m\]\u\e[0m@\h \W]\$'
else
PS1='[\[\e[34;1m\]\u\e[0m@\h \W]\$'
fi
export PS1
- Linux shell PS1设置
- linux shell命令提示符号PS1设置
- 设置linux环境变量PS1
- linux设置PS1属性
- linux环境变量PS1设置
- PS1设置Linux系统提示符
- linux环境变量设置 (PS1,PS2)
- linux中PS1的设置
- linux命令提示符设置 PS1
- Shell- PS1
- Linux shell 中的PS1&PS2&PS3&PS4
- Linux下SHELL的PS1变量简介
- Linux下SHELL的PS1变量简介
- Linux下SHELL的PS1变量简介
- Linux下SHELL的PS1变量简介
- linux shell中的变量PS1------定制linux shell提示符
- Linux终端提示符PS1设置(颜色)
- Linux终端提示符颜色设置 – PS1
- dom4j及路径笔记
- ASP.NET Padding Oracle Vulnerability
- linux 安装 intel驱动记录
- 写singleton类需要注意的一点问题(Sington类的序列化)
- Tizen不支持原生应用开发
- Linux shell PS1设置
- Windows phone 7 大全
- 用SMOD和CMOD进行SD的用户增强
- el表达式的使用细节补充
- oracle在 32位系统上运行突破sga1.7g的方法
- Tizen Toys简介
- RTF流字符替换
- video/audio playback:setDataSource
- web_reg_save_param介绍