端末ウィンドウにすべてのアクティビティを記録するにはどうすればよいですか?

端末ウィンドウにすべてのアクティビティを記録するにはどうすればよいですか?

Ubuntu 10.04/GNOME「クラシック」。

「gnome端末関連」のすべての項目をどのように記録しますか?

たとえば、2つのgnomeターミナルウィンドウを開き、それを使用して2つの異なるサーバーにSSHで接続し、数時間作業してからgnomeターミナルウィンドウを閉じて、次の2つのログファイルが必要です。

logfile-2011-09-08-10-00-02.txt
logfile-2011-09-08-10-00-04.txt

したがって、各GNOME端末を完全に文書化する必要があります。例:いつサーバーでコマンドを実行しましたか?

端末セッションを完全に録音する良い方法はありますか?クライアント側で「smitty」などのメニューをログに記録するソリューションはありますか?

ベストアンサー1

何を達成したいのかわかりませんが、特定のコマンドを実行するときに計算したい場合は、シェル履歴を確認して実行時間を追加できます。からman bash

   HISTTIMEFORMAT
          If this variable is set and not null, its value is used as a
          format string for strftime(3) to print the time stamp associated
          with each history entry displayed by the  history builtin.  If
          this variable is set, time stamps are written to the history file
          so they may be preserved across shell sessions.  This uses the
          history comment character to dis‐tinguish timestamps from other
          history lines.

十分でない場合はお支払いいただけますscript。これは、シェルに入力したすべての内容(および出力)をファイルに保存するユーティリティです。

$ script /tmp/shell-output
Script started, file is /tmp/shell-output
$ echo everything is send to /tmp/shell-output, Even ssh sessions started here

編集するscript実行可能ファイルから実行するには、~/.bashrcbashがファイルを読み取らないように制限することをお勧めしますRC

$ script -c 'bash --norc' -f /path/to/saved_file

おすすめ記事