Ps: View processes in the system. In Linux, you can use ps-aux to view all process parameters w to indicate the Command Line for widening display. parameter w can be written multiple times, usually up to three times, it means to be widened three times, which is enough to display a long command line. For example: ps-auxwwwtop: displays the system memory and cpu usage, and can
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), such as netstat-anp.
To view the server listening status, use netstat-an | grep LISTEN.
Check the connection ESTABLISHED on the server. 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 does not limit the resources that users can use, 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 <可以同时打开的文件数> Set the maximum number of files that a user can open at the same time (max open files)
Example: ulimit-n 8192
If this parameter is set too small, the too program open files error may occur for websites with a large number of concurrent visits.
Ulimit-u <可以运行的最大并发进程数> Set the max user processes)
For example, ulimit-u 1024