screen を使い始める


家のマシンにscreenコマンドを入れたので,その利用方法メモ.
+ インストール
sudo port install screen

+ 設定
ホームディレクトリに.screenrcをつくる.
.screenrc
startup_message off
autodetach on
vbell off
vbell_msg " Wuff, ---- Wuff!! "
bell "^GBell in window %."
activity "^GActivity in window %."
crlf off
msgwait 5
msgminwait 3
escape ^Z^Z # C-z C-z : send ^Z to process
bind '^k'
bind '^\'
bind '^g'
bind '?' help # C-z ?: help
bind '\\' quit # kill all window and terminate screen.
bind 'K' kill # kill current screen
bind '}' history
bind '^a' other # C-z C-a, C-z a: other window
bind 'a' other
bind 'Z' suspend # C-z z, C-z Z: suspend screen
bind 'z' suspend
bind 'G' vbell # vbell toggle
bind 'R' reset # reset screen
bind 'P' screen 9 ppp
term vt100
^z^zの部分はscreenの操作を行うときに使用するキーの指定.デフォがC-aらしいのでemacsやターミナルでの行頭移動とかぶり,変更しないといろいろ辛い.

+ screenの起動
初回の起動時には引数なしでscreenを起動
screen
+ 仮想コンソールの作成
C-z c (create)
+ 仮想コンソール一覧の表示
C-z w
+ 仮想コンソールの移動 * 昇順
C-z n (next)
+ 仮想コンソールの移動 * 降順
C-z p (previous)
+ 番号指定
C-z [番号]
+ 仮想コンソール名の設定
C-z A
+ scrrenのプロセスの一覧表示
screen -ls
+ プロセスへのアタッチ
screen -r [プロセス番号]
+ プロセスからのデタッチ
C-z d