当前位置: 首页 > news >正文

天津网站制作南昌合肥网站关键词优化公司

天津网站制作南昌,合肥网站关键词优化公司,苏州市建设局安监站网站,南宁网站建设公司哪家专业linux命令之history 1.history介绍 linux命令history会记录并显示用户所执行过的所有命令,也可以对其命令进行修改和删除操作。 2.history用法 history [参数] history参数 参数说明-a将当前会话的历史信息追加到历史文件(.bash_history)中-c删除所有条目从而清…

linux命令之history

1.history介绍

linux命令history会记录并显示用户所执行过的所有命令,也可以对其命令进行修改和删除操作。

2.history用法

history [参数]

history参数
参数说明
-a将当前会话的历史信息追加到历史文件(.bash_history)中
-c删除所有条目从而清空历史列表
-d从指定位置删除历史列表
-r读取历史文件(.bash_history)到缓冲区
-s将指定的命令添加到缓冲区
-w将缓冲区信息写入到历史文件(.bash_history)

3.实例

3.1.将当前会话的历史信息追加到历史文件(.bash_history)中

命令:

history -a

[root@centos79-3 ~]# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=128 time=247 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=128 time=361 ms
^C
--- 1.1.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1014ms
rtt min/avg/max/mdev = 247.939/304.742/361.545/56.803 ms
[root@centos79-3 ~]# ping 2.2.2.2
PING 2.2.2.2 (2.2.2.2) 56(84) bytes of data.
^C
--- 2.2.2.2 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2007ms[root@centos79-3 ~]# history -a
[root@centos79-3 ~]# tail -f .bash_history 
#1695879396
cat .bash_history 
#1695879406
clear
#1695879409
ping 1.1.1.1
#1695879414
ping 2.2.2.2
#1695879420
history -a
[root@centos79-3 ~]# 

3.2.从指定位置删除历史列表

命令:

history -d 3

[root@centos79-3 ~]# history | grep 12891289  2023-09-28 13:54:07 root set +o history1313  2023-09-28 14:05:36 root history | grep 1289
[root@centos79-3 ~]# history -d 1289
[root@centos79-3 ~]# history | grep 12891289  2023-09-28 13:55:16 root history1312  2023-09-28 14:05:36 root history | grep 12891313  2023-09-28 14:05:46 root history -d 12891314  2023-09-28 14:05:50 root history | grep 1289
[root@centos79-3 ~]# 

3.3.删除所有条目从而清空历史列表

命令:

history -c

[root@centos79-3 ~]# history -c
[root@centos79-3 ~]# 

3.4.读取历史文件(.bash_history)到缓冲区

命令:

history -r

[root@centos79-3 ~]# history -r
[root@centos79-3 ~]# tail -n 4 .bash_history 
#1695879420
history -a
#1695879044
ifconfig
[root@centos79-3 ~]# 

3.5.将缓冲区信息写入到历史文件(.bash_history)

命令:

history -w

[root@centos79-3 ~]# history -w
[root@centos79-3 ~]# tail -n 4 .bash_history 
#1695880068
clear
#1695880071
history -w
[root@centos79-3 ~]# 

3.6.不记录已执行的历史命令

命令:

set +o history

[root@centos79-3 ~]# set +o history
[root@centos79-3 ~]# ping 111.111.111.111
PING 111.111.111.111 (111.111.111.111) 56(84) bytes of data.
^C
--- 111.111.111.111 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2021ms
[root@centos79-3 ~]# tail -n 1 .bash_history 
set +o history
[root@centos79-3 ~]# 

3.7.取消不记录已执行的历史命令

命令:

set -o history

[root@centos79-3 ~]# history | tail -n 61302  2023-09-28 13:55:10 root ping 16.16.16.161303  2023-09-28 13:55:16 root history1304  2023-09-28 13:55:28 root cat .bash_history 1305  2023-09-28 13:55:42 root history1306  2023-09-28 13:55:51 root history | tail -n 41307  2023-09-28 13:55:58 root history | tail -n 6
[root@centos79-3 ~]# 

另外:

再次执行历史记录命令的三种方式:

第一个方式是:!数字

第二个方式是: ctrl+r 快捷键从小往上搜索,右方向键确定

第三个方式是: !字符串

http://www.tj-hxxt.cn/news/15264.html

相关文章:

  • 教育类企业网站磁力搜索器
  • 网站建设推广是什么意思在线咨询
  • 深圳专业网站设计制作线上营销课程
  • 云南专业网站建设网络营销的三大基础
  • 程序员能转行做网站维护不百度做个人简介多少钱
  • 网站不能访问如何做冗余网站查询是否安全
  • 求一个做烧肉的网站网站推广什么意思
  • 做公司网站解析学生个人网页制作素材
  • wordpress动态页面 收录宁波seo外包费用
  • 上海市南汇中学官网首页广州百度推广优化排名
  • 做网站先做ue百度搜索引擎优化方式
  • 广州旅游网站建设设计安卓aso关键词优化
  • 免费的域名注册网站ds2600ii色带
  • 景区智慧旅游网站建设seo下拉优化
  • 私人网站服务器搭建nba西部最新排名
  • windows卸载wordpressseo短视频网页入口
  • wordpress 获取目录seo技术培训班
  • 桂林网站开发公司免费手机网站自助建站
  • 个人网站不能有盈利性质建设网页
  • 域名邮箱怎么申请优化方案官网电子版
  • 佛教网站建设怎么在百度上投放广告
  • 做的网站怎么上线常见的推广方式有哪些
  • 长沙市做网站什么平台可以免费推广产品
  • 微企免费网站建设网络营销推广实训报告
  • 如何做网店网站连云港百度推广总代理
  • 阳谷县住房建设委网站百度代发排名
  • 网络运维前景seo怎么推排名
  • 手机网站建设品牌百度网盘搜索
  • vue 直播网站开发站长推荐入口自动跳转
  • 温州的网站建设公司网站推广系统