grep命令 是查找, 是一种强大的文本搜索工具,它能 使用正则表达式 搜索文本,并把匹 配的行打印出来。 grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户。 ps的意思是process status,即进程状态。在控制台执行man ps 命令可以查看ps命令后面的命令选项的含义如下 -A Display information about other users' processes, including those without controlling terminals
-e Identical to -A. -f Display the uid, pid, parent pid, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and the associated command. If the -u option is also used, display the user name rather then the numeric uid. When -o or -O is used to add to the display follow-
ing -f, the command field is not truncated as severely as it is in other formats.
更多的ps命令可以通过 man ps 或者 ps --help all 来获取 Linux下显示系统进程的命令ps,最常用的有ps -ef 和ps aux。这两个到底有什么区别呢?两者没太大差别,讨论这个问题,要追溯到Unix系统中的两种风格,System V风格和BSD 风格,ps aux最初用到Unix Style中,而ps -ef被用在System V Style中,两者输出略有不同。现在的大部分Linux系统都是可以同时使用这两种方式的。 UID :程序被该 UID 所拥有 PID :就是这个程序的 ID PPID :则是其上级父程序的ID C :CPU使用的资源百分比 STIME :系统启动时间 TTY :登入者的终端机位置 TIME :使用掉的CPU时间。 CMD :所下达的是什么指令
同ps -ef 不同的有列有 USER //用户名 %CPU //进程占用的CPU百分比 %MEM //占用内存的百分比 VSZ //该进程使用的虚拟內存量(KB) RSS //该进程占用的固定內存量(KB)(驻留中页的数量) STAT //进程的状态 START //该进程被触发启动时间 TIME //该进程实际使用CPU运行的时间 其中STAT状态位常见的状态字符有 D //无法中断的休眠状态(通常 IO 的进程); R //正在运行可中在队列中可过行的; S //处于休眠状态; T //停止或被追踪; W //进入内存交换 (从内核2.6开始无效); X //死掉的进程 (基本很少见); Z //僵尸进程; < //优先级高的进程 N //优先级较低的进程 L //有些页被锁进内存; s //进程的领导者(在它之下有子进程); l //多线程,克隆线程(使用 CLONE_THREAD, 类似 NPTL pthreads); + //位于后台的进程组; systemctl status mysql systemctl is-enabled 命令:service nginx status 
查看某个服务的状态 作者:Gakki0725 链接:https://www.jianshu.com/p/907286f53972 来源:简书
systemctl list-unit-files --type=service
|