まずは screen をインストール。
# apt-get install screen Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: iselect screenie byobu The following NEW packages will be installed: screen 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 654 kB of archives. After this operation, 964 kB of additional disk space will be used. Get:1 http://ftp.jp.debian.org/debian/ wheezy/main screen i386 4.1.0~20120320gitdb59704-7 [654 kB] Fetched 654 kB in 3s (186 kB/s) Selecting previously unselected package screen. (Reading database ... 18723 files and directories currently installed.) Unpacking screen (from .../screen_4.1.0~20120320gitdb59704-7_i386.deb) ... Processing triggers for install-info ... Processing triggers for man-db ... Setting up screen (4.1.0~20120320gitdb59704-7) ...
よくある設定。/etc/screenrc を読み込み。caption を設定。caption は常に表示。headstatus は無視。term を screen-256color に。
cat <<EOT >> ~/.screenrc
source /etc/screenrc
caption string "%H %?%F%{= Gk}%:%{= Bk}%? %-w%?%F%{= rw}%:%{= rw}%?%n %t%{-}%+w%=%{-} %l %D %d/%m/%Y %c"
caption always
hardstatus ignore
term screen-256color
EOT
caption に指定した string は以下のように分割できる。
00: %H %?%F%{= Gk}%:%{= Bk}%? %-w%?%F%{= rw}%:%{= rw}%?%n %t%{-}%+w%=%{-} %l %D %d/%m/%Y %c
01: %H
02: %?%F%{= Gk}%:%{= Bk}%?
03: %-w
04: %?%F%{= rw}%:%{= rw}%?
05: %n
06: %t
07: %{-}
08: %+w
09: %=
10: %{-}
11: %l
12: %D
13: %d
14: /
15: %m
16: /
17: %Y
18: %c
| %H | %H (ホスト名) を表示 |
| %?%F%{= Gk}%:%{= Bk}%? | %F が true なら (ウィンドウにフォーカスがあれば) %{= Gk} (背景色を明るい緑、文字色を黒) そうでなければ %{= Bk} (背景色を明るい青、文字色を黒) |
| %-w | %-w (現在のウインドウより前のウィンドウリスト) を表示 |
| %?%F%{= rw}%:%{= rw}%? | %F が true なら (ウィンドウにフォーカスがあれば) %{= rw} (背景色を暗い赤、文字色を白) そうでなければ %{= rw} (背景色を暗い赤、文字色を白) |
| %n | %n (現在のウインドウの番号) を表示 |
| %t | %t (現在のウインドウのタイトル) を表示 |
| %{-} | 一つ前の色指定 (ここでは現在のウィンドウ番号及びタイトルに対する背景色と文字色の指定、04 行目) をリセット |
| %+w | %+w (現在のウインドウより後のウィンドウリスト) を表示 |
| %= | 以降を右寄せ |
| %{-} | 一つ前の色指定 (ここではウィンドウ一覧に対する背景色と文字色の指定、02 行目) をリセット |
| %l | %l (ロードアベレージ) を表示 |
| %D | %D (曜日) を表示 |
| %d | %d (日付) を表示 |
| / | / を表示 |
| %m | %m (月) を表示 |
| / | / を表示 |
| %Y | %Y (西暦) を表示 |
| %c | %c (時間) を表示 |