文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>LINUX下如何查看命令历史及输入时间(抄自CU)

LINUX下如何查看命令历史及输入时间(抄自CU)

时间:2007-03-20  来源:soul_of_moon

感觉有点意思,有空再看看。因为有点零散(主要是三人),所以改转载为抄自。   No.1 export PROMPT_COMMAND='{
date "+: %c; `history 1 | { read x cmd; echo "$cmd"; }`";
} >;>; $HOME/.history-timestamp'

或者安装 Bash 3.0
http://ftp.gnu.org/gnu/bash/bash-3.0.tar.gz
bb. New HISTTIMEFORMAT variable; value is a format string to pass to
    strftime(3).  If set and not null, the `history' builtin prints out
    timestamp information according to the specified format when displaying
    history entries.  If set, bash tells the history library to write out
    timestamp information when the history file is written.

或者用Snare for Linux大炮打苍蝇
  No.2
试了有个楼主给的PROMPT_COMMAND,总是有问题。自己就写了个麻烦点的。 把他们加到.bashrc文件中, source .bashrc 即可。
# === Begin ====
datestamp_history(){
export infodate=`date "+: %c"`
export infohis=`history 1`
echo $infodate' =>; '$infohis >;>; $HOME/.history-timestamp
}
export PROMPT_COMMAND=datestamp_history
# === end =====
 
No.3
export PROMPT_COMMAND='{ z=$(history 1 | { read x y; echo $y; }); echo -n $(date "+%c") :: $z ::; who am i; } >> $HOME/.history-timestamp'  
排行榜 更多 +
鲸鱼相机

鲸鱼相机

图像拍照 下载
玩美P图

玩美P图

游戏工具 下载
模拟生存大挑战

模拟生存大挑战

模拟经营 下载