Linux common commands (below)

TTY: Terminal "?" is a daemon, deamon has no terminal

VSZ: occupies virtual memory size

RSS: Occupied memory size

ps–axf: view process tree

ps –axm: list threads

pspid: show pid process

pstree : display the process tree

top : Dynamic monitoring process

Time System started time Number of users Current system load… Zombie process

96.0id: CPU resource idle ratio; memory and Swap

Monitor a specific user: enter u, enter user name, enter

Terminate the specified process: enter k, enter the process number to be terminated

Specify the system status update time: top -d 10: 1 update every 10 seconds

When top is running, you can control the display mode of the process through the internal command of top:

l: Turn on or off the top information on the first line of the first part

t: Turn on or off the second line of Tasks and the third line of Cpus information in the first part

m: Turn on or off the Swap information in the fourth line of the first part and the fifth line of Mem

N: Processes are arranged in order of PID size

P: Sort processes by CPU usage size

M: Sort processes by memory usage size

q: quit top

top-p pid: only monitor pid threads

vmstat: Linux system monitoring tool, is a tool to view the usage of virtual memory vm

In Linux memory management, mainly through "Paging" and "Swap Swaping", Paging: swap pages that are not frequently used in memory to disk, Swaping: swap the entire process to disk

Page-out: paging to disk; Page-in: paging back to memory

vmstat2 10:

r: The number of processes in the run queue exceeds the number of CPUs, resulting in a CPU bottleneck

b: The number of blocked processes waiting for IO, the blocked process

swpd: The number of virtual memory KB currently used, if it is greater than 0, it means that the machine memory is insufficient

free: the number of KB of physical memory currently free

buff: buffer memory size

cache: the memory size of the cache

si: The size of the virtual memory that swapin reads from the swap area per second. If it is greater than 0, it means that the physical memory is not enough.

so: swapout The size of the swap area written from the virtual memory to the swap area per second. If it is greater than 0, it means that the physical memory is not enough.

bi: blockin The total amount of data read into memory from the block device per second (read from disk)

bo:blockout The total amount of blocks written from memory to block devices per second (writes to disk)

in: interrupts per second

cs: context switches per second

us: user user process execution time

sy: system system process execution time

id: idle cpu idle time

wa: wait cpu wait IO time

Via /proc/cpuinfo : View CPU performance

grep 'model name'/proc/cpuinfo: View the number of CPU and CPU cores

jstack :

jps: Find out the pid of the java process

top –p pid: observe the process situation

Shift + h : show all threads of the process

Convert the thread id to 16 processes, such as thread id 3720 == 0x7d0, pay attention to lowercase

jstack pid | grep -A 10 0x7d0: Query the status of a specific thread, which can basically locate the problem of the program

Learn about other JVM monitoring tools when needed

kill process number : to terminate the process, it is essentially a negotiated exit, not a forced exit

kill-9 (KILL) Process ID: send SIGKILL signal to force termination of process

killall process number: kill process and child processes

kill–STOP pid: send a SIGSTOP signal to suspend the background process

kill --CONT pid: resume a process that was suspended in the background

kill–l:list available signals

Kill signal description:

2)SIGINT^C sends a SIGINT to all the processes in theforeground process group. To do the equivalent with kill,kill –SIGINT pid(OS-level concept)or to the job,kill –SIGINT %(shell-level concept,the pipeline ended with&)

man command : command manual

info command : View command documentation online

Enter / : Gegexp search

stty –a:get all the terminal controlcharacter assignments

For example, intr = ^C, susp = ^Z, etc.

free -m: View memory usage

Memory description file: cat /proc/meminfo: memory usage of the machine

/proc/pid/maps: Displays the virtual addresses occupied by the current process

/proc/pid/statm: memory occupied by the process

Linux free memory: free + buffers + cached

export : set or display environment variables (temporary)

exportPAHT=&PATH:&HOME/bin:root/test:set the PATH environment variable

If export is written to: /etc/profile or /etc/bashrc globally, then for all users, the environment variable will take effect permanently

If you write export to: /home/zzjie/.bashrc or .bash_profile, it is only valid for the user environment variable logged in by zzjie

echo $PATH: View the PATH environment variable

/etc/profile: Set the environment information for each user of the system, when the user logs in for the first time, this file is executed

/etc/bashrc: execute this file for every user running a bash shell, this file is read when the bash shell is opened

/zzjie/profile: Environment settings for zzjie users

/zzjie/bashrc: The bash shell configuration of the zzjie user, which initializes bash, such as bash code completion, bash aliases, etc.

/zzjie/bash_logout: This file is executed every time the user exits the bash shell

alias : specify an alias

aliasdump='mysqldump –u root –p db > /home/date.bak': Specify the database backup operation alias dump

aliassubl="/home/zzjie/Downloads/Sublime\ Text\ 2/Sublime\ Text\2/sublime_text"

shell wildcard : *?

reptyr:reptyr is a utilityfor taking an existing running program and attaching it to a new terminal

iptraf : Network measurement tool

iptraf–g:

iptraf–d eth0:

Notes : The command is finally executed in the Linux kernel, but first passed to the shell parser and then to the Kernel

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324843721&siteId=291194637