UNIX common monitoring and management command

xiaoxiao2021-03-05  29

PS: View the process in the system, you can use PS -AUX to view all processes in Linux

The parameter w represents the widening command line, the parameter W can write multiple times, usually write up to 3 times, indicating that the widen is 3 times, which is enough to display a long command line.

For example: ps -auxwww

TOP: Display system memory, CPU usage, and automatically refresh process list

VMSTAT: Shows current memory usage

NetStat: Display network conditions, use the parameter P to view the corresponding process number and program name,

Usually use parameter A (display all connection conditions) and N (no referendum name and service name),

For example: NetStat-Anp

View server listening situation, use:

Netstat -an | GREP LISTEN

View the connection of the server has been established, use:

Netstat -an | GREP ESTABLISHED

IFConfig: View (or set) Network device information

Ifconfig -a: View all network settings information

Last: Display the situation of logging in to the server and the server restart

DF: Displays the hard disk space and usage, and the parameter h can be taken under Linux, and the display result is more user-friendly. E.g:

DF -H hard disk space is displayed in humanized

DF -K hard disk space Press KB display

DF -M hard disk space Press MB display

W: Display the list of users logged in to the server

The following orders are only for Linux

LSOF: Displays the currently open file list, including the established Socket connection, and the like. This command can be used for programmers to check the number of files opened by programmers.

Sysctl: Display (or set) system kernel parameters

Sysctl -a Displays all kernel parameters

SYSCTL -W parameter name = parameter value

For example: sysctl -w fs.file-max = 10240 Setting the system allows the maximum number of files to be opened at the same time 10240.

The kernel parameter fs.file-nr includes three parameter values, the first parameter indicates the number of files that have been opened at the same time in the system.

The second parameter represents the number of files that are idle (released after allocation),

The third parameter represents the maximum number of files that can be opened, which is equal to FS.FILE-MAX.

The number of files currently opened = the first parameter value - the second parameter value

E.g:

FS.FILE-NR = 977 223 10240

The number of files currently opened = 977 - 233 = 744

Be careful when setting the kernel parameters, if the setting is not properly caused, even when it is even.

Ulimit: Display (or set) the resource limit available for users

Ulimit -a Displays the resource restrictions that users can use

ULIMIT UNLIMITED does not limit the resources you can use, but this setting is the maximum number of files that open (Max Open files)

And the maximum number of processes that can run simultaneously (Max user processes) is invalid

ULIMIT-N

For example: ulimit -n 8192

If this parameter is set too small, there may be an error in Too Many Open Files for a website that is always a large number of visitors.

ULIMIT -U

转载请注明原文地址:https://www.9cbs.com/read-34136.html

New Post(0)