进程管理

ps -e 列出所有进程 -f 指出进程全名

pgrep

Usage:
 pgrep [options] <pattern>

Options:
 -d, --delimiter <string>  指定输出分隔符
 -l, --list-name           列出进程号和进程名字
 -a, --list-full           列出进程号和全命令行
 -v, --inverse             否认已匹配到的,也就是反转
 -w, --lightweight         列出所有线程ID
 -c, --count               计算匹配到的进程数量,抑制正常输出,只输出数量
 -f, --full                用全名进程匹配
 -g, --pgroup <PGID,...>   匹配进程组ID
 -G, --group <GID,...>     匹配真实的组ID
 -n, --newest              选择最近开启的进程
 -o, --oldest              选择最先开启的进程
 -P, --parent <PPID,...>   只匹配指定父进程的子进程号
 -s, --session <SID,...>   匹配会话ID
 -t, --terminal <tty,...>  匹配控制终端,tty
 -u, --euid <ID,...>       -u参数后可以是用户名或用户ID
 -U, --uid <ID,...>        匹配真实ID,可以多个ID,多个ID之间用逗号分隔
 -x, --exact               精确匹配命令名字
 -F, --pidfile <file>      从文件中读取进程号
 -L, --logpidfile          如果文件没有被锁就失败
 --ns <PID>                匹配属于同一个命名空间的进程ID
 --nslist <ns,...>         list which namespaces will be considered for
                           the --ns option.
                           Available namespaces: ipc, mnt, net, pid, user, uts
 -h, --help     帮助信息
 -V, --version  版本信息

pkill -HUP 重新加载配置文件

killall -u 停止指定用户的所有进程

skill

signal

regex

lsof 查看占用文件或端口的进程

pidof 查看一个进程的pid

服务管理

systemctl status|start|stop|disable|enable|reload|restart 服务名.service

原文地址:https://www.cnblogs.com/zhengwenqiang/p/7727053.html