Bash的历史命令

一 历史命令
1、语法
history [选项] [历史命令保存文件]
选项:
-c:清空历史命令
-w:把缓存中的历史命令写入历史命令保存文件~/.bash_histoty
历史命令默认保存1000条,可以在环境变量配置文件/etc/profile中进行修改。
2、历史命令调用方式


 
3、命令与文件补全
在Bash中,命令与文件补全是非常方便与常用的功能,我们只要在输入命令或文件时,按“Tab”键就会自动补全。
 
二 实战
[root@localhost ~]# history -w
[root@localhost ~]# history
1 cat .bash_history
2 history -w
3 history
[root@localhost ~]# vi /etc/profile
[root@localhost ~]# history
1 cat .bash_history
2 history -w
3 history
4 vi /etc/profile
5 history
[root@localhost ~]# !3
history
1 cat .bash_history
2 history -w
3 history
4 vi /etc/profile
5 history
6 history
[root@localhost ~]# !!
history
1 cat .bash_history
2 history -w
3 history
4 vi /etc/profile
5 history
6 history
[root@localhost ~]# !cat
cat .bash_history
cat .bash_history
history -w
[root@localhost ~]# user
useradd userdel userhelper usermod usernetctl users
[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost ~]# cd /
bin/ dev/ home/ lib/ media/ mydata/ proc/ run/ srv/ tmp/ var/
boot/ etc/ japan/ lib64/ mnt/ opt/ root/ sbin/ sys/ usr/
[root@localhost ~]# cd /
bin/ dev/ home/ lib/ media/ mydata/ proc/ run/ srv/ tmp/ var/
boot/ etc/ japan/ lib64/ mnt/ opt/ root/ sbin/ sys/ usr/
[root@localhost ~]# cd /usr/
bin/ etc/ games/ include/ lib/ lib64/ libexec/ local/ sbin/ share/ src/ tmp/
[root@localhost ~]# cd /usr/l
lib/ lib64/ libexec/ local/
[root@localhost ~]# cd /usr/l
lib/ lib64/ libexec/ local/
[root@localhost ~]# cd /usr/local/
  • 大小: 118.9 KB
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值