TOP cygwin Linux
ref:Bash カラープロンプト
黒色(Black) | 0;30 |
青色(Blue) | 0;34 |
緑色(Green) | 0;32 |
水色(Cyan) | 0;36 |
赤色(Red) | 0;31 |
紫色(Purple) | 0;35 |
明灰色(Light Gray) | 0;37 |
暗灰色(Dark Gray) | 1;30 |
Light Blue | 1;34 |
Light Green | 1;32 |
Light Cyan | 1;36 |
Light Red | 1;31 |
Light Purple | 1;35 |
黄色(Yellow) | 1;33 |
白色(White) | 1;37 |
\a | ベル(ビープ音)をならす(ASCII のベル文字 07) |
\d | "曜日 月 日"の形式の日付 |
\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 | ホスト名(最初の . までの名前) |
\H | ホスト名 |
\j | the number of jobs currently managed by the shell |
\l | the basename of the shell's terminal device name |
\n | 改行 |
\r | 復帰 |
\s | the name of the shell, the basename of $0 (the portion following the final slash) |
\t | 時刻 HH:MM:SS 形式(24時間) H = Hour = 時、M = Minutes = 分、S = Seconds = 秒 |
\T | 時刻 HH:MM:SS 形式(12時間) |
\@ | 時刻 am/pm をつけたもの。Lang=Jaの場合 HH:MM (午前|午後)となる。 |
\A | the current time in 24-hour HH:MM format |
\u | 現在のユーザー名 |
\v | bash のバージョン(e.g., 2.00) |
\V | bash のバージョン・リリース番号など詳細(e.g., 2.00.0) |
\w | 現在のディレクトリ(フルパス) |
\W | 現在のディレクトリ名 |
\! | コマンドのヒストリー番号 |
\# | コマンドのコマンド番号(ログイン後何回実行したか) |
\$ | UID が 0 であれば『 # 』、それ以外は『 $ 』 |
\nnn | the character corresponding to the octal number nnn |
\\ | バックスラッシュ |
\[ | 表示されない文字列(エスケープシーケンス/端末制御シーケンス)を埋め込む |
\] | 表示されない文字列の終わり |
カーソルの位置をセット | \[\033[<row>;<column>f\] |
現在のカーソル位置を保存 | \[\033[s\] |
位置を復元する | \[\033[u\] |
右上のコーナーに時計を表示します | PS1=">\[\033[s\]\[\033[1;\$*1f\]\$(date +%H:%M)\[\033[u\]" |
ref:[PS1とPROMPT_COMMAND, GNU screenでの活用も>http://rcmdnk.github.io/blog/2013/03/21/prompt-com...]]
Change the prompt color using tput
$ export PS1="\[$(tput bold)$(tput setb 4)$(tput setaf 7)\]\u@\h:\w $ \[$(tput sgr0)\]"
tput setab [1-7] | Set a background color using ANSI escape |
tput setb [1-7] | Set a background color |
tput setaf [1-7] | Set a foreground color using ANSI escape |
tput setf [1-7] | Set a foreground color |
tput bold | Set bold mode |
tput dim | turn on half-bright mode |
tput smul | begin underline mode |
tput rmul | exit underline mode |
tput rev | Turn on reverse mode |
tput smso | Enter standout mode (bold on rxvt) |
tput rmso | Exit standout mode |
tput sgr0 | Turn off all attributes |
printf "\e]2;Hello World!\a" || ** PROMPT_COMMAND =|| PROMPT_COMMAND='printf "\e]0;%s@%s:%s\a" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
最新コメント