每天学一个 Linux 命令(87):history
发布日期:2021-07-01 03:54:39
浏览次数:3
分类:技术文章
本文共 1031 字,大约阅读时间需要 3 分钟。
点击下方“民工哥技术之路”,选择“设为星标”
回复“1024”获取独家整理的学习资料!
命令简介
history 命令用于查看系统中用户执行命令的历史纪录。读取历史命令文件中的目录到历史命令缓冲区和将历史命令缓冲区中的目录写入命令文件。
历史命令是被保存在内存中的,当退出或者登录 shell 时,会自动保存或读取。在内存中,历史命令仅能够存储 1000 条历史命令,该数量是由环境变量 HISTSIZE 进行控制。
语法格式
history [OPTIONS ]
选项说明
-c #清空当前历史命令-d offset #删除偏移量 OFFSET 处的历史记录条目-a #将历史命令缓冲区中命令写入历史命令文件中-r #将历史命令文件中的命令读入当前历史命令缓冲区-w #将当前历史命令缓冲区命令写入历史命令文件中
应用举例
打印20条历史命令(最近使用,从最后一条往前数)
[root@centos7 ~]# history 20 876 /usr/sbin/time 877 which time 878 find / -type f -name "time" 879 find / -name "time" 880 /sys/module/printk/parameters/time 881 find / -name "time*" 882 time --help 883 time -V 884 man time 885 yum install time -y 886 time -V 887 time --help 888 /usr/bin/time 889 /usr/bin/time -f "time: %U" ls 890 /usr/bin/time -f "time: %U" cat download/mingongge 891 /usr/bin/time -f "time: %S" cat download/mingongge 892 /usr/bin/time -f "time: %E" cat download/mingongge 893 /usr/bin/time cat download/mingongge 894 time cat download/mingongge 895 history 20
推荐阅读 点击标题可跳转
转载地址:https://mingongge.blog.csdn.net/article/details/115291000 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
做的很好,不错不错
[***.243.131.199]2024年04月14日 08时47分41秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
秋招总结(三)-操作系统归纳
2019-05-01
LINUX CP命令详解
2019-05-01
source insight快捷键及使用技巧
2019-05-01
映 射 ALT 键
2019-05-01
vim使用快捷键F4生成文件头注释、F5生成main函数模板、F6生成.h文件框架模板
2019-05-01
OV5620的视频驱动
2019-05-01
C++中两个类交叉定义或递归定义的解决办法
2019-05-01
记一次Hive 行转列 引起的GC overhead limit exceeded
2019-05-01
OpenGL ES八 - 交叉存取顶点数据
2019-05-01
crontab定时任务写法
2019-05-01
nginx: [emerg] unknown directive "if($remote_addr" in /usr/local/tools/nginx/conf/nginx.conf:57
2019-05-01
module pip has no attribute main问题解决
2019-05-01
LeetCode 134.Gas Station (加油站)
2019-05-01
Python之命名元组 (namedtuple)
2019-05-01
使用libpcap过滤arp
2019-05-01
[转帖]Robots.txt指南
2019-05-01
正则表达式简介(微软)--6.优先权顺序
2019-05-01
多用户与多租户的区别
2019-05-01