Common commands for Linux to view system information


Use the command to view Linux system version, kernel version, CPU model, hard disk space, memory information and network information.

1. View system version: LSB_ release -a

2. View kernel version: uname – A

3. View CPU model: cat / proc / cpuinfo

4. View hard disk space: DF – H

5. View memory information: Free – M

6. View network information: ifconfig

Common commands for viewing linux environment information

Set the process number as PID and the port number as port.

1. CPU utilization

Command: Top – P PID,% CPU, unit: percentage.

2. Physical memory usage

Command: Top – P PID, res, unit: KB.

3. Virtual memory usage

Command: Top – P PID, virt, unit: KB.

4. Process queue length

Command: top, load average. The three values represent the average length of the process queue in the latest 1 minute, 5 minutes and 15 minutes respectively.

5. Open socket and its status

Command: netstat – an | grep port, the fourth column represents the source IP, the fifth column represents the destination IP, and the sixth column represents the status (such as listen, established, time)_ Wait, etc.).

Alternative command: SS, several kernel modules need to be installed. When there are many connections, the performance is much better than that of netstat.

Install kernel module command:

insmod /lib/modules/2.6.18-164.el5/kernel/net/ipv4/inet_diag.ko

insmod /lib/modules/2.6.18-164.el5/kernel/net/ipv4/tcp_diag.ko

insmod /lib/modules/2.6.18-

insmod /lib/modules/2.6.18-

6. I / O utilization

Command: iostat – x,% util, in percentage.

7. Disk read / write rate

Command: iostate – K, KB_ Read / s refers to the number of KB data read by the disk per second, KB_ Wrtn / s indicates how many KB of data are written to the disk per second.

8. Recent system calls and their time-consuming

Command: strace – F – TT – t – P PID, the first item represents the name of the system call, and the last item represents the time consumed by the call, in seconds.

9. Number of open file descriptors

Command: LS / proc / PID / FD | WC – L.

10. Process address space

Command: PMAP – D PID.

11. Environmental variables

Command: cat / proc / PID / environment.

12. Memory usage of process modules

Command: cat / proc / PID / smaps.

13. Process status information

Command: cat / proc / PID / status, state represents the process state (running, sleeping, zombie, etc.), sleepavg represents the proportion of sleep time of the process, TGID represents the thread group number, PPID represents the parent process number, fdsize represents the maximum number of file descriptors, vmsize represents the generation

Vlck represents the size of the process’s locked physical memory, which cannot be exchanged to disk, vmrss represents the size of the physical memory the process is using, vmdata represents the size of the process’s data segment, and vmstk represents the process in user mode

Vmexe represents the size of the executable virtual memory owned by the process, code segments, excluding the library used, vmlib represents the size of the library mapped to the process address space, all in KB, sigq represents the number of signals to be processed, and sigblk represents the blocked signals

Sigign represents the ignored signal and sigcgt represents the captured signal.

14. Number of threads in the process

Command: LS / proc / PID / task | WC – L.

15. Command line to start the process

Command: cat / proc / PID / CmdLine.

16. List which files are opened by the current system and which processes are opened respectively

Command: sudo lsof – n

17. Make the program generate the core dump file actively

Command: GDB – P PID – batch – ex “generate core file”

Recommended Today

Practice of query operation of database table (Experiment 3)

Following the previous two experiments, this experiment is to master the use of select statements for various query operations: single table query, multi table connection and query, nested query, set query, to consolidate the database query operation.Now follow Xiaobian to practice together!Based on the data table (student, course, SC, teacher, TC) created and inserted in […]