How to change your shell prompt

來源:互聯網
上載者:User

 http://www.understudy.net/custom.html

 

Description csh* ksh bash tcsh* zsh
Current working directory $CWD $PWD \w %/ %/
Current working directory, with one's home directory by `~' $CWD:t $PWD##*/ \W %~ %~
Full hostname 'uname -n' 'uname -n' N/A %M %M
Hostname up to the first '.' `hostname -s` `hostname -s` \h %m %m
Start (stop) boldfacing mode %B (or %b) N/A N/A %B (or %b) %B (or %b)
Start (stop) standout mode %S (or %s) N/A N/A %S (or %s) %S (or %s)
Start (stop) underline mode %U (or %u) N/A N/A %U (or %u) %U (or %u)
User name `whoami` `logname` \u %n %n
The shell's tty that the user is logged in on %l N/A N/A %| %|
The current history number %h N/A \! %h (or %!) %h (or %!)
Name of the shell N/A N/A \s N/A N/A
Time of day in 12-hour hh:mm AM/PM %t N/A \@ %t (or %@) %t (or %@)
Time of day in 24-hour hh:mm %T N/A \A %T %T
Time of day in 12-hour with seconds hh:mm:ss AM/PM %p N/A \T %p N/A
Time of day in 24-hour with seconds hh:mm:nn %P N/A \t %P %*
The day in 'dd' format %D N/A N/A %D N/A
The month in 'Mon' format %w N/A N/A %w N/A
The month in 'mm' format %W N/A N/A %W N/A
The year in 'yy' format %y N/A N/A %y N/A
The year in 'yyyy' format %Y N/A N/A %Y N/A
The date in "Weekday Month Date" format N/A N/A \d N/A N/A
The date in day-dd format N/A N/A N/A N/A %w
The date in Mon/dd/yy format N/A N/A N/A N/A %W
The date in yy-mm-dd format N/A N/A N/A N/A %D
The weekday in 'Day' format %d N/A N/A %d N/A
Description csh* ksh bash tcsh* zsh

set prompt = "`whoami`%B[%@]%b@%m[%/]# "

目前使用者 加粗 目前時間 不加粗 @ 機器名 [當前工作目錄]

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.