Home>Article>Operation and Maintenance> What is the command to view ports and kill processes in macos system?

What is the command to view ports and kill processes in macos system?

王林
王林 forward
2020-12-15 10:18:16 2897browse

What is the command to view ports and kill processes in macos system?

The specific commands are as follows:

lsof command can list all occupied ports:

lsof

Use less paging query

lsof | less

View

sudo lsof -i:port(端口号)

For example:

sudo lsof -i:8095 COMMAND PID USER FD TYPE DEVICESIZE/OFF NODE NAME java 7748 Dang 58u IPv6 0x613f359336d889a3 0t0 TCP *:8095 (LISTEN)

Kill the process:

sudo kill -9 7748

Related recommendations:macos system

The above is the detailed content of What is the command to view ports and kill processes in macos system?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete