每天一命令之history

来自linux中国网wiki
Evan讨论 | 贡献2020年3月3日 (二) 01:52的版本 (创建页面,内容为“=history= ==DESCRIPTION== <pre> DESCRIPTION Many programs read input from the user a line at a time. The GNU History library is able to keep track of those…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

history

DESCRIPTION

DESCRIPTION
       Many  programs  read input from the user a line at a time.  The GNU History library is able to keep track of those lines,
       associate arbitrary data with each line, and utilize information from previous lines in composing new ones.

OPTIONS

   -c	清空当前历史命令 clear the history list by deleting all of the entries
  -d offset	删除历史记录中第offset个命令 delete the history entry at position OFFSET. Negative
    		offsets count back from the end of the history list


-N: 显示历史记录中最近的N个记录;

-a:将历史命令缓冲区中命令写入历史命令文件中;
-r:将历史命令文件中的命令读入当前历史命令缓冲区;
-w:将当前历史命令缓冲区命令写入历史命令文件中;

-n<filename>:读取指定文件

完全清除命令执行操作的历史记录

1.清理历史记录(只是清理了表层,可在.bash_history找到回)
history -c


2.清理记录历史的记录文件内容

echo " " > .bash_history 

see also

Linux中history配置及使用技巧

history命令