PS: View processes in the system. In Linux, you can use PS-Aux to view all processes.
The W parameter indicates the command line for widening display. The w parameter can be written multiple times. Generally, it can be written three times at most, indicating that the command line is widened three times, which is enough to display a long command line.
Example: PS-auxwww
Top: displays the system memory and CPU usage, and automatically refreshes the process list.
Vmstat: displays the current memory usage
Netstat: displays network conditions. You can use the p parameter to view the corresponding process number and program name,
Generally, parameters a (display all connections) and N (do not reverse query the domain name and service name) are used ),
Example: netstat-ANP
To view the server listening status, use:
Netstat-an | grep listen
View the connection established on the server, and use:
Netstat-an | grep established
Ifconfig: view (or set) network device information
Ifconfig-A: view all network settings
Last: displays the logon status to the server and server restart status.
DF: displays the hard disk space and usage. in Linux, the parameter H can be used to display more user-friendly results. For example:
DF-H hard drive space display by user
DF-K hard disk space is displayed in KB
DF-M hard disk space is displayed in MB
W: displays the list of users logging on to the server.
The following commands are only applicable to Linux
Lsof: displays the list of currently opened files, including established socket connections. This command can be used by programmers to check the number of files opened by the program.
Sysctl: displays (or sets) system kernel parameters.
Sysctl-A displays all Kernel Parameters
Sysctl-W parameter name = parameter value
For example, sysctl-W fs. File-max = 10240 sets the maximum number of files allowed to be opened simultaneously by the system to be 10240.
The Kernel Parameter fs. File-Nr contains three parameter values. The first parameter indicates the peak number of files that have been simultaneously opened in the system,
The second parameter indicates the number of idle (released after allocation) files,
The third parameter indicates the maximum number of files that can be opened. The value is equal to FS. File-max.
Number of files currently opened = first parameter value-second parameter value
For example:
FS. File-Nr = 977 223 10240
Number of files currently opened = 977-233 = 744
Be careful when setting kernel parameters. Improper settings may cause system exceptions or even crash.
Ulimit: displays (or sets) resource limits that can be used by users
Ulimit-A displays the resource limits that users can use
Ulimit Unlimited
Resources that can be used by users are not limited, but this setting sets the maximum number of files that can be opened (max open files)
The maximum number of processes that can run simultaneously (max user processes) is invalid.
Ulimit-n <number of files that can be opened at the same time> sets the maximum number of files that can be opened at the same time (max
Open files)
Example: ulimit-N 8192
If this parameter is set too small, too open may appear for websites with a large number of concurrent visits.
Files Error
Ulimit-u <maximum number of concurrent processes that can be run>
Set the max user processes)
For example, ulimit-u 1024