zoukankan      html  css  js  c++  java
  • cat ~/.bash_history

    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.
  • 相关阅读:
    hdu 1875 畅通project再续(kruskal算法计算最小生成树)
    Http post提交和get提交
    我的软考之路(五)——数据结构与算法(3)之图
    WPF 布局控件 之 DockPanel
    oracle存储结构
    马化腾最想做的事情是人工智能
    Android_Zip解压缩工具
    Unity的 Stats 窗体, Batched、SetPass、Draw Call 等
    尝试 “实验楼”在线教育平台
    POJ 3181 Dollar Dayz 01全然背包问题
  • 原文地址:https://www.cnblogs.com/xuanbjut/p/11914652.html
Copyright © 2011-2022 走看看