Linux Commands To Check Network Connection
lsof vs netstat – which of these two Linux networking commands works better, if you want to find out which Linux networking program is running on or openning a TCP/IP network port? Take a look on these commands output, you might get the answer then.

Netstat is almost a generic networking command, although its functions or features might be varied across the diverse system platforms. The Linux netstat command is used to check or print the TCP/IP network activities of both active (established) and inactive (listening) ports. You can tweak the netstat command with its supported option switches for more useful TCP/IP network statistics.
I used to run
Today, however, I couldn’t find an in-house developed daemon (which we call it XML-Server) with my favourite netstat -tulpan command!
As shown in the diagram, login with root user ID and executing command
After googling, I learnt a new Linux command. Essentially, lsof is another great Linux command used to print or find out the system resources that are currently using or holding by Linux processes!
Now, executing
Of course, I can simple run
Howto, Linux, IP, Linux, Lsof, Netstat, Network, TCP, UDP
» How To Fix Telnet Rejection Error of Name or Service Not Known: Illegal Seek
» Private IP VS Public IP: How To Check WAN IP, Public IP, or Internet IP?
» Configure VNC Server To Auto Start Up In Red Hat Linux
» Map Linux Network Drive With SHFS Module
» Df And Du Command Show Different Used Disk Space
» Broadband Internet Reliability and Latency Are Important Than Speed
» How To Choose A Home Broadband Internet Service?
« Office 2007 Validation Failed By IE7 Protected Mode In Windows Vista
» Demi Moore 1990 VS Demi More 2007
Netstat is almost a generic networking command, although its functions or features might be varied across the diverse system platforms. The Linux netstat command is used to check or print the TCP/IP network activities of both active (established) and inactive (listening) ports. You can tweak the netstat command with its supported option switches for more useful TCP/IP network statistics.
I used to run
netstat -tulpan on both Redhat and Debian Linux servers for network-related support calls. These netstat command option switches will tell me what a networking program is doing – the TCP/IP protocol in used (TCP / UDP), number of bytes dropped, local network port and its connected port at remote server (established) or local listening port of the daemon (server), the name and process ID of the networking program.Today, however, I couldn’t find an in-house developed daemon (which we call it XML-Server) with my favourite netstat -tulpan command!
As shown in the diagram, login with root user ID and executing command
netstat -tulpan | grep 2020 shows that the network port 2020 is opened and listening for connection, but the XML-Server program is unknown. When grep network port number 389, I can see the Open-LDAP daemon as well as its associated process ID in the list. (So, I’ve login as root and only root user privilege can run netstat with -p option to print all networking utilities that are running on the Linux system!).After googling, I learnt a new Linux command. Essentially, lsof is another great Linux command used to print or find out the system resources that are currently using or holding by Linux processes!
Now, executing
lsof -i | grep 2020 or lsof -i | grep xmlserver is showing me the XML-Server daemon and its process ID. Then, I can issue kill -9 command to kill off XML-Server program as part of the troubleshooting process.Of course, I can simple run
ps -elf | grep xmlserver to get the process ID and kill it. But, what if you only know the network port but not the program name, or the network port and program are both being unknown?!Howto, Linux, IP, Linux, Lsof, Netstat, Network, TCP, UDP
» How To Fix Telnet Rejection Error of Name or Service Not Known: Illegal Seek
» Private IP VS Public IP: How To Check WAN IP, Public IP, or Internet IP?
» Configure VNC Server To Auto Start Up In Red Hat Linux
» Map Linux Network Drive With SHFS Module
» Df And Du Command Show Different Used Disk Space
» Broadband Internet Reliability and Latency Are Important Than Speed
» How To Choose A Home Broadband Internet Service?
Custom Search
![]() |
» Demi Moore 1990 VS Demi More 2007

























[...] this particular scenario, the lsof command (list open file command) is great to show [...]
[...] the DB2 server side configuration completed, execute either the netstat or lsof command (with root user account) should able to show the port is opened and listening for [...]
[...] tee mysql command gets the SQL result output to two places at the same time, just like the tee Linux command [...]