TCSH命令记录器

时间:2013-02-18 17:15:21

标签: shell logging tcsh

每次在shell中输入命令时,有没有办法在tcsh中记录历史记录(并将其保存在.history文件中)?像这里给bash的解决方案: Bash Command Logger

1 个答案:

答案 0 :(得分:1)

是。有几个shell变量(由set命令指定的变量,而不是环境变量)控制其工作方式:

  • history 指定将在当前shell中记住的命令数
  • histfile 命名文件以保存历史记录(默认情况下为〜/ .history
  • savehist ,指定将命令的历史记录记录到历史记录文件

例如,您可以将以下内容放在.tcshrc文件中:

set history = 1000  # remember 1000 commands
set savehist = 100  # write the last 100 commands to $histfile
set histfile = "~/.my-history"

此外,根据手册页,执行history -S将写入当前历史记录(由上述变量控制)。

注意:对于我来说,history -S似乎在Mac OSX的10.8上运行不佳;它挂了壳

相关问题