7.history命令

history命令用于显示历史执行过的命令,格式为“history [-c]”。

history命令应该是作者最喜欢的命令。执行history命令能显示出当前用户在本地计算机中执行过的最近1000条命令记录。如果觉得1000不够用,还可以自定义/etc/profile文件中的HISTSIZE变量值。在使用history命令时,如果使用-c参数则会清空所有的命令历史记录。还可以使用“!编码数字”的方式来重复执行某一次的命令。总之,history命令有很多有趣的玩法等待您去开发。

[root@linuxprobe ~]# history
1 tar xzvf VMwareTools-9.9.0-2304977.tar.gz
2 cd vmware-tools-distrib/
3 ls
4 ./vmware-install.pl -d
5 reboot
6 df -h
7 cd /run/media/
8 ls
9 cd root/
10 ls
11 cd VMware\ Tools/
12 ls
13 cp VMwareTools-9.9.0-2304977.tar.gz /home
14 cd /home
15 ls
16 tar xzvf VMwareTools-9.9.0-2304977.tar.gz
17 cd vmware-tools-distrib/
18 ls
19 ./vmware-install.pl -d
20 reboot
21 history
[root@linuxprobe ~]# !15
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates
Desktop          Downloads  Music                 Public    Videos

历史命令会被保存到用户家目录中的.bash_history文件中。Linux系统中以点(.)开头的文件均代表隐藏文件,这些文件大多数为系统服务文件,可以用cat命令查看其文件内容。

[root@linuxprobe ~]# cat ~/.bash_history

要清空当前用户在本机上执行的Linux命令历史记录信息,可执行如下命令:

[root@linuxprobe ~]# history -c

8.sosreport命令

sosreport命令用于收集系统配置及架构信息并输出诊断文档,格式为sosreport。

当Linux系统出现故障需要联系技术支持人员时,大多数时候都要先使用这个命令来简单收集系统的运行状态和服务配置信息,以便让技术支持人员能够远程解决一些小问题,亦或让他们能提前了解某些复杂问题。在下面的输出信息中,加粗的部分是收集好的资料压缩文件以及校验码,将其发送给技术支持人员即可:

[root@linuxprobe ~]# sosreport
sosreport (version 3.0)
This command will collect diagnostic and configuration information from
this Red Hat Enterprise Linux system and installed applications. An archive containing the collected information will be generated in
/var/tmp and may be provided to a Red Hat support representative.
Any information provided to Red Hat will be treated in accordance with
the published support policies at: https://access.redhat.com/support/ The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party. No changes will be made to system configuration.
Press ENTER to continue, or CTRL-C to quit. 此处敲击回车来确认收集信息 Please enter your first initial and last name [linuxprobe.com]:此处敲击回车来确认主机编号
Please enter the case number that you are generating this report for:此处敲击回车来确认主机编号
Running plugins. Please wait ...
Running 70/70: yum...
Creating compressed archive...
Your sosreport has been generated and saved in: /var/tmp/sosreport-linuxprobe.com-20170905230631.tar.xz
The checksum is: 79436cdf791327040efde48c452c6322
Please send this file to your support representative.

cat ~/.bash_history的更多相关文章

  1. 设置root用户不保存终端历史记录到.bash_history

    在.bashrc的最后行追加 unset HISTFILE cat .bash_history 还能看到 unset HISTFILE 之前保留的命令unset HISTFILE 之后的命令不会保留, ...

  2. 一些关于Linux入侵应急响应的碎碎念

    近半年做了很多应急响应项目,针对黑客入侵.但疲于没有时间来总结一些常用的东西,寄希望用这篇博文分享一些安全工程师在处理应急响应时常见的套路,因为方面众多可能有些杂碎. 个人认为入侵响应的核心无外乎四个 ...

  3. Linux基础介绍【第三篇】

    更改SSH服务端远程登录的配置 windows服务端的默认远程管理端口是3389,管理员用户是administrator,普通用户是guest.Linux的管理用户是root,普通用户默认有很多个,远 ...

  4. Linux命令随笔

    Linux命令总结 man ==命令帮助; help ==命令的帮助(bash的内置命令); ls ==list,查看目录列表; -ld:查看目录权限; -l:(long)长格式显示属性; -F:给不 ...

  5. [笔记]linux用户与用户组

    sudo useradd -m john 自动建立主目录 sudo passwd john sudo useradd -g groupusers mike sudo useradd -s /bin/b ...

  6. 第2章 新手必须掌握的Linux命令

      第2章 新手必须掌握的Linux命令 章节简述: 本章节讲述系统内核.Bash解释器的关系与作用,教给读者如何正确的执行Linux命令以及常见排错方法. 经验丰富的运维人员可以恰当的组合命令与参数 ...

  7. Linux提权基础

    英文原文: Basic Linux Privilege Escalation 在开始之前,我想指出 - 我不是专家. 据我所知,在这个巨大的领域没有一个“魔法”的答案. 这只是我的发现,写出来,共享而 ...

  8. Linux C++ 开发常用工具,常用指令工作手册

    vim常用: :set nu显示行数 :set mouse=a 鼠标滑动屏幕,:set ic :set noic 忽略不忽略大小写 /word_to_search\c \c表示忽略大小写 c小写忽略, ...

  9. linux_shell_4_shell特性

    去年的这个时候,我曾经写过一些关于shell特性的文章,下面是第3篇:linux_shell_3_shell变量特性. 今天我们继续来学习一些关于 Linux shell的内容. [1]shell 在 ...

随机推荐

  1. angularjs 图片上传

    <input type="file" file-model="myFile"/><div class="col-md-12" ...

  2. 记一次在virtualbox中安装windows7遇到增强功能安装分辨率的问题

    在windows7中遇到很多次安装好增强功能后并不能对其实现放大分辨率,使其跟随虚拟机界面大小而改变. 经过许多次的安装和恢复快照,发现了在设置中,显存的大小一直都是处于边缘的状态, 关闭虚拟机后,我 ...

  3. Springboot项目中使用@RestControllerAdvice注解不生效排查思路

    说明: 在后端编写业务逻辑时,可能会遇到异常抛出处理的情况,后端通常会通过throw出一个异常,然后通过@RestControllerAdvice注解标注自定义类进行统一处理,前端再将接收到的结果解析 ...

  4. Score UVA - 1585

    ​ There is an objective test result such as "OOXXOXXOOO". An 'O' means a correct answer of ...

  5. PTA沈师数据库原理——DB(10)_SQL实验题

    R10-1 A1-3查询顾客表中所有不重复的城市 (2 分) select distinct Cityfrom customersR10-2 查询学生表所有学生记录 (2 分) select * fr ...

  6. 模拟退火算法Python编程(2)约束条件的处理

    1.最优化与线性规划 最优化问题的三要素是决策变量.目标函数和约束条件. 线性规划(Linear programming),是研究线性约束条件下线性目标函数的极值问题的优化方法,常用于解决利用现有的资 ...

  7. hdu4861 找规律了

    题意:      给你k个球和一个整数p,每个球的价值是 1^i+2^i+...+(p-1)^i (mod p),两个人轮流取球,最后谁的总价值也大谁就赢,问你先手能不能赢. 思路:      一开始 ...

  8. 进程保护原理Hook函数Openprocess

    Win32子系统:                                                                                            ...

  9. Google Chrome飞天小恐龙

    输入网址 chrome://dino/ ,F12->console,上代码 满分 Runner.instance_.setSpeed(99999); 不死护体 window.tempGameOv ...

  10. 【报错】org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSocketHandlerMapping' defined in class path resource

    环境:maven+eclipse+jdk1.8 [tomcat使用的是maven自带的插件,实质原因就是出在tomcat版本问题] 背景:在进行SSM集成WebSocket的时候,项目启动报org.s ...