history用法

来源:互联网 发布:星座分布 大数据 编辑:程序博客网 时间:2024/06/05 15:04

history:

 

列出所有的历史记录:
[test@linux] # history
只列出最近10条记录:
[test@linux] # history 10 (注,history和10中间有空格)
使用命令记录号码执行命令,执行历史清单中的第99条命令
[test@linux] #!99 (!和99中间没有空格)
重复执行上一个命令
[test@linux] #!!


执行最后一次以rpm开头的命令(!?  ?代表的是字符串,这个String可以随便输,Shell会从最后一条历史命令向前搜索,最先匹配的一条命令

将会得到执行。)
[test@linux] #!rpm


----------------------------------------------
[test@linux]# history [n]
[test@linux]# history [-c]
[test@linux]# history [-raw] histfiles
参数:
n   :数字,要列出最近的 n 笔命令列表
-c  :将目前的shell中的所有 history 内容全部消除
-a  :将目前新增的history 指令新增入 histfiles 中,若没有加 histfiles ,
则预设写入 ~/.bash_history
-r  :将 histfiles 的内容读到目前这个 shell 的 history 记忆中
-w  :将目前的 history 记忆内容写入 histfiles

-------------------------------------------

 

http://www.9usb.net/200906/linux-history-mingling.html

原创粉丝点击