Linux战地日记——历史命令
2015-09-10 13:36
399 查看
历史命令
历史命令存放在.~/.bash_history中,他在用户主目录下。通过输入$ history可查询当前历史命令
[bestcoder@localhost test1]$ history 1 history 2 history -a 3 history 4 pwd 5 date 6 cat test1 7 cd test1 8 history
通过-c选项可删除历史文件中的所有清单
[bestcoder@localhost ~]$ history 1 history
执行历史命令
命令替换的方式之一,以“!”开头。格式
!! 重复上一条命令
!n 重复第n条命令
!-n 重新执行倒数第n条命令
!ca 重新执行以ca开头的命令
!?string? 重新执行最新的包含字符串string的历史命令
!# 到目前所输入的整个命令行
[bestcoder@localhost test1]$ !2 history -a [bestcoder@localhost test1]$ !4 pwd /home/bestcoder/test1 [bestcoder@localhost test1]$ !date date 2015年 09月 09日 星期三 22:28:13 PDT
可通过$ HISTFILE="/home/test/.myhistory"指定存放历史命令的文件。
可通过$ HISTSIZE=600指定bash保存的历史命令。
相关文章推荐
- Linux系统的关机、重启以及登出命令
- [Linux]history 显示命令的运行时间
- CentOS 7系统上架设DNS服务
- centos 7 安装caffe
- 一入wine深似海,从此奋战到天明
- linux 重定向中的 &> 和 >的作用
- linux杀死进程报错问题
- Linux文件属主显示数字
- linux系统安装后优化
- linux系统安装后优化
- vi/vim 使用方法讲解
- 虚拟机安装CentOS6.4用“桥接:直接连接到物理网线”不能上网的原因及解决方法
- VMware虚拟机安装Linux centOS 6.5使用桥接
- linux后台运行和关闭、查看后台任务
- Linux中cron命令的用法详解
- CentOS7+Mysql-5.2.26+php-5.6.12+Zabbix-2.4.6
- 个人学习笔记--linux中断下半部之软中断
- centos服务器搭建svn
- Linux DM9000网卡驱动程序完全分析
- LinuxMint 17.2休眠后重新开机(使用电池)鼠标没有反应