在prompt字串做變化:
- username@host: export PS1='n u@h W'
- 增加顏色 PS1='n u@h e[32m W'
- 另一範例: export PS1='n u@h e[32m W e[0m'
-
http://www.linux.com/article.pl?sid=04/11/16/1753219
Color
Foreground
Background
Black
30
40
Red
31
41
Green
32
42
Yellow
33
43
Blue
34
44
Magenta
35
45
Cyan
36
46
White
37
47
PS1 提示符號的完整說明必須用man bash來查詢; 但bash的內容太多了, 不易瀏覽, 由Google找到
查詢man指令的網站: http://www.mediacollege.com/linux/man/index.html
可以顯示得較容易觀看. PS1的變更要找其內的PROMPTING, 特殊字元如下:
a an ASCII bell character (07)
d the date in "Weekday Month Date" format(e.g., "Tue May 26")
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
u the username of the current user
v the version of bash (e.g., 2.00)
V the release of bash, version + patchlevel (e.g., 2.00.0)
w the current working directory
W the basename of the current working directory
! 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
##
您可能也會有興趣的類似文章
- [Windows] 去除環境變數DATE與TIME內的空白 (0則留言, 2008/04/20)
- 開始使用Cygwin以取代cmd.exe (2則留言, 2007/01/11)
- [Vista] 設定環境變數SET命令的擴充 (0則留言, 2008/04/19)
- Command Prompt Explorer Bar: 將DOS視窗嵌入檔案總管 (4則留言, 2010/01/23)
- 如何用批次指令取得上個月的月份-再修訂版 (10則留言, 2008/10/21)
- [Cygwin] 與常用DOS命令的對應簡表 (4則留言, 2007/01/19)
- 方便切換目錄的指令:PUSHD與POPD (0則留言, 2006/07/15)
- RTF另存檔成DOC的VBS程式 (3則留言, 2006/06/01)
- 命令提示字元的完美替身:PowerCmd與Console 2.0 (3則留言, 2008/05/09)
- [Windows] 環境變數的擴充功能 (1則留言, 2005/02/23)
- DOS命令使用技巧3:由DOS視窗將目前資料夾用檔案總管開啟的方法 (0則留言, 2010/02/27)
- [Tools] 用7-Zip取代PKZipC (1則留言, 2005/07/18)
- DOS視窗的設定 (0則留言, 2005/01/20)
- DOS (命令提示字元) 的巨集功能 (3則留言, 2005/01/18)
- DOS命令使用技巧4:由DOS視窗迅速切換資料夾的方法 (0則留言, 2010/02/27)















最新留言