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

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*

猜你喜欢

转载自blog.csdn.net/Star__2008/article/details/81194148