Super User Asked by appshare.co on December 27, 2020
One alternative is the use of the lsof
utility; specifically, lsof -i 4tcp
will list all processes with some sort of TCP IPv4 network sockets open. The manpage of lsof
will provide you with detailed information on how to use the utility and how to interpret the output.
Correct answer by ayaz on December 27, 2020
I use the command below when I want to see everything that's on a specific port for either TCP or UDP. The -n
option disables attempting to resolve the IP addresses into domain names, and the -P
disables attempting to figure out the name of a particular port. Also, running as root
will show you more processes than running as a normal user.
sudo lsof -iTCP:53 -iUDP:53 -n -P
Answered by M. Scott Ford on December 27, 2020
If you are interested in a specific port, you can use this example:
lsof -i 4tcp:8080 -sTCP:LISTEN
If you would only like to get the process id, you can run this:
lsof -i 4tcp:8080 -sTCP:LISTEN -Fp
Answered by Zsolt Balogh on December 27, 2020
The following code example lists all running TCP servers on your local macOS machine:
netstat -a -Ptcp | egrep 'tcp4.*LISTEN'
tcp4 0 0 127.0.0.1.2022 *.* LISTEN 0 0
tcp4 0 0 *.3141 *.* LISTEN 0 0
LISTEN
shows only sockets listening for connections. That is, servers.
The first line shows a server bound to localhost
, aka 127.0.0.1
, port 2022
. It will answer to local requests, but not Internet-based requests.
The second line is a server bound to all addresses, ie *
, port 3141
. It will answer Internet queries.
To list ports used by clients and servers, use the following:
netstat -an -Ptcp | grep tcp4
Answered by johntellsall on December 27, 2020
This should be possible in a terminal window using the Netstat command.
And if you like the GUI way more:
With Mac OS X 10.5, the /Applications/Utilities folder contains a network utility called: Network Utility, see tab Netstat for these stats presented in a gui application, along with Ping, Lookup, Traceroute, Whois, Finger and Port Scan.
Answered by fretje on December 27, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP