pidof command
The pidof command is used to query the PID value of a specified service process in the form of "pidof [parameter] [service name].
The process number value (PID) of each process is unique, so different processes can be distinguished by PID. For example,
The following commands can be used to query the PID of the sshd service program on the machine:
[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 command
The killall command is included in "psmisc-22.20-15.el7.x86_64"
The killall command is used to terminate all processes corresponding to a service with a specified name in the format: "killall [parameter] [service]
Business name]".
Generally speaking, the service program of complex software will have multiple processes cooperating to provide services to users, if they end up here one by one.
Some processes can be cumbersome, at which point killall commands can be used to batch end all processes with a service program. lower
Take the httpd service program as an example to end its entire process.
[root@localhost ~]# pidof httpd 3211 3210 3209 3208 3207 3206 [root@localhost ~]# killall httpd [root@localhost ~]# pidof httpd
uname command
The uname command is used to view information about the system's kernel and version in the form of "uname [-a].
When using uname command, the - a parameter is usually fixed to view the kernel name and master of the current system.
Machine name, kernel release version, node name, system time, hardware name, hardware platform, processor type and operating system name
Weigh and wait for information.
[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
Incidentally, if you want to see the details of the current system version, you need to look at the redhat-release file.
The order and the corresponding results are as follows:
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
uptime command
Uptime is used to view system load information in uptime format.
The uptime command is really great. It shows the current system time, the running time of the system, and the number of enabled terminals to
And the average load value and other information. Average load value refers to the system pressure in the last 1 minute, 5 minutes and 15 minutes.
The lower the load value, the better, try not to exceed 1 for a long time, and do not exceed 1 in the production environment.
Over 5.
[root@localhost ~]# uptime 17:49:44 up 4:33, 2 users, load average: 0.00, 0.01, 0.05
free command
Free is used to display memory usage information in the current system in the format of "free [-h].
In order to ensure that Linux systems do not suddenly crash due to resource exhaustion, operators need to keep an eye on memory usage.
When using the free command, you can use the - h parameter to output the real-time usage information of the current memory in a more humane way.
[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 command
The last command is used to view login records for all systems in the form of "last [parameter].
Use the last command to view the local login record. However, since this information is preserved in the form of log files
There is a system, so hackers can easily tamper with content. Never just use the output of the command.
Judge whether the system has been maliciously invaded!
[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 command
"sos-3.5-9.el7.centos.noarch"
The sosreport command is used to collect system configuration and architecture information and output diagnostic documents in the form of sosreport.
When a Linux system fails and technical support personnel need to be contacted, this command should be used most of the time to simplify it.
Single collection of system operation status and service configuration information, so that technical support personnel can remotely solve some minor problems, also
Or let them know some complex problems ahead of time. In the output information below, the bolder part is the data compression that has been collected.
Documents and check codes can be sent to technical support staff:
[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.Collect information here by return confirmation Please enter your first initial and last name [localhost.localdomain]: The main engine number is determined here by return Please enter the case id that you are generating this report for []: The main engine number is determined here by return 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.