List open ports
11 March 2022 (Updated 18 May 2022)
sudo lsof -Pni
- lsof: list open files.
- -P: prevent conversion of port numbers to port names (e.g., display
80
instead ofhttp
). - -n: prevent conversion of network numbers to network names (e.g., display
201.87.138.40
instead ofproduction
). - -i: only show internet addresses (i.e., in the form
[protocol][@hostname|hostaddr][:service|port]
).
Example output:
WirelessR 606 root 3u IPv4 0xf76f1b9010e10d75 0t0 UDP *:*
assistant 614 sajad 24u IPv4 0xf76f1b9010e35655 0t0 UDP *:*
netbiosd 640 _netbios 3u IPv4 0xf76f1b9010e0a245 0t0 UDP *:137
netbiosd 640 _netbios 4u IPv4 0xf76f1b9010e0a555 0t0 UDP *:138
mongod 674 sajad 9u IPv4 0xf76f1b8679250a1d 0t0 TCP 127.0.0.1:27017 (LISTEN)
nginx 686 sajad 6u IPv4 0xf76f1b867924ff8d 0t0 TCP *:8080 (LISTEN)
nginx 686 sajad 7u IPv4 0xf76f1b867924ea6d 0t0 TCP *:80 (LISTEN)
redis-ser 687 sajad 6u IPv4 0xf76f1b867924f4fd 0t0 TCP 127.0.0.1:6379 (LISTEN)
redis-ser 687 sajad 7u IPv6 0xf76f1b8b43c077b5 0t0 TCP [::1]:6379 (LISTEN)
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment