pdiof命令,killall命令,uname命令,uptime命令,free命令,last命令,sosreport命令

pidof命令

pidof 命令用于查询某个指定服务进程的 PID 值,格式为“pidof [参数] [服务名称]”。
每个进程的进程号码值(PID)是唯一的,因此可以通过 PID 来区分不同的进程。例如,
可以使用如下命令来查询本机上 sshd 服务程序的 PID:

[root@localhost ~]# pidof sshd
3131 2657 1234
[root@localhost ~]# ps aux | grep sshd
root      1234  0.0  0.4  82432  3540 ?        Ss   13:16   0:00 /usr/sbin/sshd -D
root      2657  0.0  0.6 142852  5012 ?        Ss   13:31   0:00 sshd: root@pts/0
root      3131  0.1  0.6 142852  5016 ?        Ss   17:35   0:00 sshd: root@pts/1
root      3158  0.0  0.1 112660   932 pts/1    S+   17:37   0:00 grep --color=auto sshd

killall命令

“psmisc-22.20-15.el7.x86_64”中包含killall命令

killall 命令用于终止某个指定名称的服务所对应的全部进程,格式为:“killall [参数] [服
务名称]”。
通常来讲,复杂软件的服务程序会有多个进程协同为用户提供服务,如果逐个去结束这
些进程会比较麻烦,此时可以使用 killall 命令来批量结束某个服务程序带有的全部进程。下
面以 httpd 服务程序为例,来结束其全部进程。

[root@localhost ~]# pidof httpd
3211 3210 3209 3208 3207 3206
[root@localhost ~]# killall httpd
[root@localhost ~]# pidof httpd

uname命令

uname 命令用于查看系统内核与系统版本等信息,格式为“uname [-a]”。
在使用 uname 命令时,一般会固定搭配上-a 参数来完整地查看当前系统的内核名称、主
机名、内核发行版本、节点名、系统时间、硬件名称、硬件平台、处理器类型以及操作系统名
称等信息。

[root@localhost ~]# uname -a
Linux localhost 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

顺带一提,如果要查看当前系统版本的详细信息,则需要查看 redhat-release 文件,其命
令以及相应的结果如下:

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 

uptime命令

uptime 用于查看系统的负载信息,格式为 uptime。
uptime 命令真的很棒,它可以显示当前系统时间、系统已运行时间、启用终端数量以
及平均负载值等信息。平均负载值指的是系统在最近 1 分钟、5 分钟、15 分钟内的压力情
况(下面加粗的信息部分);负载值越低越好,尽量不要长期超过 1,在生产环境中不要超
过 5。

[root@localhost ~]# uptime
 17:49:44 up  4:33,  2 users,  load average: 0.00, 0.01, 0.05

free 命令

free 用于显示当前系统中内存的使用量信息,格式为“free [-h]”。
为了保证 Linux 系统不会因资源耗尽而突然宕机,运维人员需要时刻关注内存的使用量。
在使用 free 命令时,可以结合使用-h 参数以更人性化的方式输出当前内存的实时使用量信息。

[root@localhost ~]# free -h
             total       used       free     shared    buffers     cached
Mem:          3.9G       1.3G       2.5G       1.7M        23M       180M
-/+ buffers/cache:       1.1G       2.7G
Swap:         2.0G         0B       2.0G

last命令

last 命令用于查看所有系统的登录记录,格式为“last [参数]”。
使用 last 命令可以查看本机的登录记录。但是,由于这些信息都是以日志文件的形式保
存在系统中,因此黑客可以很容易地对内容进行篡改。千万不要单纯以该命令的输出信息而
判断系统有无被恶意入侵!

[root@localhost ~]# last
root     pts/1        192.168.1.118    Fri Aug  3 17:35   still logged in   
root     pts/1        192.168.1.126    Wed Aug  1 15:12 - 17:31 (2+02:18)   
root     pts/1        192.168.1.126    Wed Aug  1 14:45 - 15:12  (00:27)    
root     pts/0        192.168.1.64     Wed Aug  1 11:45 - 17:51 (2+06:05)   
root     pts/0        192.168.1.64     Wed Aug  1 11:32 - 11:33  (00:01)    
reboot   system boot  3.10.0-327.el7.x Wed Aug  1 11:30 - 17:56 (2+06:26)   
root     pts/0        192.168.1.64     Wed Aug  1 11:17 - down   (00:10)    
reboot   system boot  3.10.0-327.el7.x Wed Aug  1 11:17 - 11:28  (00:11)    
root     pts/0        192.168.1.64     Mon Jun 18 13:25 - down  (43+10:53)  
root     pts/0        192.168.1.64     Sun Jun 17 04:10 - 06:57  (02:46)    
root     pts/0        192.168.1.64     Sat Jun 16 23:31 - 04:05  (04:34)    
root     pts/0        192.168.1.64     Sat Jun 16 21:25 - 23:08  (01:43)    
root     pts/0        192.168.1.64     Sat Jun 16 15:55 - 21:24  (05:29)    
root     pts/0        192.168.1.64     Sat Jun 16 06:21 - 12:09  (05:48)    
root     pts/0        192.168.1.64     Fri Jun 15 21:35 - 23:38  (02:02)    
root     pts/0        192.168.1.64     Fri Jun 15 21:20 - 21:23  (00:03)    
root     pts/0        192.168.1.64     Fri Jun 15 12:28 - 21:16  (08:48)    
root     pts/0        192.168.1.64     Thu Jun 14 20:49 - 21:24  (00:34)    
root     pts/0        192.168.1.64     Thu Jun 14 18:48

sosreport命令

“sos-3.5-9.el7.centos.noarch”

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

[root@localhost ~]# sosreport

sosreport (version 3.2)

This command will collect diagnostic and configuration information from
this CentOS Enterprise Linux system and installed applications.

An archive containing the collected information will be generated in
/tmp/sos.vYC3rI 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 [localhost.localdomain]: 此处按回车确定主机编号
Please enter the case id that you are generating this report for []: 此处按回车确定主机编号

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Running 86/86: yum...                      
[plugin:kvm] could not unmount /sys/kernel/debug
Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-localhost.localdomain-20180804102716.tar.xz

The checksum is: 4ed799aa94282ad95c9424ab4a5e80e3

Please send this file to your support representative.

猜你喜欢

转载自blog.csdn.net/tjjingpan/article/details/81407663