Linux 内存与进程管理

Author: yifei / Created: Nov. 15, 2017, 12:55 p.m. / Modified: Nov. 15, 2017, 8:59 p.m. / Edit

ps 命令

最常用的两种形式 ps -efH or ps -ef

pgrep process_name


# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

top 命令


kill 命令

kill -s SIGNAL pid

pkill 命令

不要使用 killall process_name,use pkill over killall see


lsof -i:port 列出指定端口对应的进程

lsof -u username 指定用户

lsof -c process_name 指定进程名

lsof -p pid 指定pid

使用dmesg 查看当前的内核日志,debian上可以查看 /var/log/kern.log /var/log/dmesg.0

RSS is Resident Set Size (physically resident memory - this is currently occupying space in the machine's physical memory), and VSZ is Virtual Memory Size (address space allocated - this has addresses allocated in the process's memory map, but there isn't necessarily any actual memory behind it all right now).[1]