MacOS-如何查看所有正在运行的进程 如何杀掉进程

See all running processes & Kill processes in Mac OS

top

The top program periodically displays a sorted list of system processes.  

The default sorting key is pid, but other keys can be used instead.  Various out-put options are available. 

       -o <key>

Order the process display by sorting on <key> in descending order.  

A + or - can be prefixed to the key name to specify ascending or descending order, respectively.  

ps

The ps utility displays a header line, followed by lines containing information about all of your processes that have controlling terminals. A different set of processes can be selected for display by using any combination of the -a, -G, -g, -p, -T, -t, -U, and -u etc. options.

       -a  

Display information about other users' processes as well as your own.  This will skip any processes which do not have a controlling terminal, unless the -x option is also specified.

       -u      

Display the processes belonging to the specified usernames.

       -x      

When displaying processes matched by other options, include processes which do not have a controlling terminal.  This is the opposite of the -Xoption.  If both -X and -x are specified in the same command, then ps will use the one which was specified last. 

eg.

In terminal, find the processes of anaconda, then kill it.

Stars-MacBook-Pro:~ star$ ps aux |  grep conda*
star             53371   1.9  2.1  2984764 174108   ??  S    11:06PM   1:42.31 /Users/star/anaconda3/bin/python /Users/star/anaconda3/bin/anaconda-navigator
star             53368   0.0  0.0  2446780    712   ??  S    11:06PM   0:00.03 /bin/sh /Users/star/anaconda3/Anaconda-Navigator.app/Contents/MacOS/run.sh
star             56534   0.0  0.0  2432804    776 s000  S+   10:59PM   0:00.00 grep conda*
Stars-MacBook-Pro:~ star$ kill 53371
Stars-MacBook-Pro:~ star$ ps aux |  grep conda*
star             56536   0.0  0.0  2432804    776 s000  S+   10:59PM   0:00.00 grep conda*

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值