ksaitoの日記

日々試したことの覚え書き

ttyrec

移転しました。

自動的にリダイレクトします。

ttyrecは、CUIの操作を記録するときに便利なコマンドです。

$ sudo aptitude install ttyrec
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
Reading state information... 完了
Reading extended state information
Initialising package states... 完了
Building tag database... 完了
The following packages have been automatically kept back:
  linux-image-generic linux-restricted-modules-generic
The following packages have been kept back:
  linux-headers-generic
The following NEW packages will be installed:
  ttyrec
0 packages upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 30.6kB of archives. After unpacking 131kB will be used.
Writing extended state information... 完了
Get:1 http://jp.archive.ubuntu.com edgy/universe ttyrec 1.0.6-1 [30.6kB]
Fetched 30.6kB in 0s (256kB/s)
未選択パッケージ ttyrec を選択しています。
(データベースを読み込んでいます ... 現在 111749 個のファイルとディレクトリがインストールされています。)
(.../ttyrec_1.0.6-1_i386.deb から) ttyrec を展開しています...
ttyrec (1.0.6-1) を設定しています ...

$

使い方は、ttyrecと入力したあとに記録したい操作をします。
操作が終ったら[Ctrl]+[D]で記録を止めます。
ここでは、echoコマンドでtestという文字を表示する操作を記録します。

$ ls
$ ttyrec
$ echo test
test
$ [Ctrl]+[D]exit

再生は、ttyplayコマンドを使います。
先程の操作でttyrecordというファイルが出きていますので、それを引数に指定します。

$ ls
ttyrecord
$ ttyplay ttyrecord
$ echo test
test
$ exit
$

ちょっと、面白いです。

ttyrecに引数でファイル名を指定すると記録するファイル名を指定できます。
-aオプションを使うと一度作成した記録ファイルに追記できます。