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!