O'Reilly logo

How Linux Works by Brian Ward

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Diagnostic Tools

netstat is one of the most basic network service debugging tools, telling you what ports are open and whether any programs are listening on ports. For example, if you want to view all open TCP ports, run this command:

netstat -t

Table 6-2 lists the netstat options.

Table 6-2. netstat Options

Option

Description

-t

Prints TCP port information

-u

Prints UDP port information

-l

Prints listening ports

-a

Prints every active port

-n

Disables name lookups (useful if DNS isn't working)

Being able to list open and listening ports is good, but our good old friend lsof can go one step further.

lsof

In Finding Open Files with lsof you saw how lsof can track open files, but lsof can also list the programs currently using or listening to ports. For a complete ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required