加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Bash的历史命令

发布时间:2020-12-15 16:24:55 所属栏目:安全 来源:网络整理
导读:一 历史命令 1、语法 history [选项] [历史命令保存文件] 选项: -c:清空历史命令 -w:把缓存中的历史命令写入历史命令保存文件~/.bash_histoty 历史命令默认保存1000条,可以在环境变量配置文件/etc/profile中进行修改。 2、历史命令调用方式 3、命令与文
一 历史命令
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/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读