CentOS系统里的历史命令:history
分类:CentOS教程 阅读:44947 次
[root@linux ~]# history [n]
[root@linux ~]# history [-c]
[root@linux ~]# history [-raw] histfiles
参数:
n :数字,意思是『要列出最近的 n 笔命令列表』的意思!
-c :将目前的 shell 中的所有 history 内容全部消除
-a :将目前新增的 history 指令新增入 histfiles 中,若没有加 histfiles ,
则预设写入 ~/.bash_history
-r :将 histfiles 的内容读到目前这个 shell 的 history 记忆中;
-w :将目前的 history 记忆内容写入 histfiles 中!
范例:
范例一:列出目前内存内的所有 history 记忆
[root@linux ~]# history
# 前面省略
1017 man bash
1018 ll
1019 history
1020 history
# 列出的信息当中,共分两栏,第一栏为该指令在这个 shell 当中的代码,
# 另一个则是指令本身的内容喔!至于会秀出几笔指令记录,则与 HISTSIZE 有关!
范例二:列出目前最近的 3 笔资料
[root@linux ~]# history 3
1019 history
1020 history
1021 history 3
范例三:立刻将目前的资料写入 histfile 当中
[root@linux ~]# history -w
# 在预设的情况下,会将历史纪录写入 ~/.bash_history 当中!
[root@linux ~]# echo $HISTSIZE
1000
[root@linux ~]# history [-c]
[root@linux ~]# history [-raw] histfiles
参数:
n :数字,意思是『要列出最近的 n 笔命令列表』的意思!
-c :将目前的 shell 中的所有 history 内容全部消除
-a :将目前新增的 history 指令新增入 histfiles 中,若没有加 histfiles ,
则预设写入 ~/.bash_history
-r :将 histfiles 的内容读到目前这个 shell 的 history 记忆中;
-w :将目前的 history 记忆内容写入 histfiles 中!
范例:
范例一:列出目前内存内的所有 history 记忆
[root@linux ~]# history
# 前面省略
1017 man bash
1018 ll
1019 history
1020 history
# 列出的信息当中,共分两栏,第一栏为该指令在这个 shell 当中的代码,
# 另一个则是指令本身的内容喔!至于会秀出几笔指令记录,则与 HISTSIZE 有关!
范例二:列出目前最近的 3 笔资料
[root@linux ~]# history 3
1019 history
1020 history
1021 history 3
范例三:立刻将目前的资料写入 histfile 当中
[root@linux ~]# history -w
# 在预设的情况下,会将历史纪录写入 ~/.bash_history 当中!
[root@linux ~]# echo $HISTSIZE
1000
热门推荐
- CentOS 7手工创建自己的YUM仓库
- CentOS 7中iptables服务暂停启动和保存备份
- CentOS下LVM逻辑卷的创建及使用
- CentOS部署SSH密钥登陆
- CentOS下的正斜杠"/"和"\"的区别
- CentOS下防火墙的基本操作命令
- CentOS下添加新硬盘并分区格式化
- CentOS下文件系统类型的学习
- CentOS如何查看硬盘品牌型号等具体信息
- CentOS 7 64位安装配置PXE服务器
- CentOS只查看文件夹的几种方法
- CentOS 7.1添加删除用户
- centos7防火墙配置
- CentOS 7.1配置防火墙
- CentOS下iptables的端口映射
- CentOS中chkconfig命令的基本使用
- CentOS下让vim显示行号
- centos7通过邮件定时发送linux系统状态
- CentOS6下ssh简介及openssh的应用
- CentOS开启和关闭防火墙