"lsof" - List of Open Files

This section provides a tutorial example on how to use 'lsof' command to display network connections as open files

"lsof" is a command line tool that allows you to list of open files by all processes currently running on the system. It includes options to list network connections as open files.

List of all network connections as open files.

herong$ lsof -i

COMMAND       PID     USER  TYPE NODE NAME
systemd         1     root  IPv4  TCP *:sunrpc (LISTEN)
systemd         1     root  IPv6  UDP *:sunrpc
systemd         1     root  IPv6  TCP *:websm (LISTEN)
avahi-dae    1256    avahi  IPv4  UDP *:mdns
avahi-dae    1256    avahi  IPv6  UDP *:35424
chronyd      1288   chrony  IPv4  UDP localhost:323
dnsmasq      2265  dnsmasq  IPv4  UDP *:bootps
mysqld       5067    mysql  IPv6  TCP *:opsession-prxy (LISTEN)
httpd        5839     root  IPv6  TCP *:https (LISTEN)
sshd        14871     root  IPv4  TCP *:ssh (LISTEN)
mysqld      28037    mysql  IPv6  TCP *:mysql (LISTEN)
cupsd       28201     root  IPv6  TCP localhost:ipp (LISTEN)
dovecot     28244     root  IPv4  TCP *:pop3s (LISTEN)
dovecot     28244     root  IPv6  TCP *:imaps (LISTEN)
vsftpd      28601     root  IPv6  TCP *:ftp (LISTEN)
pptpd      898747     root  IPv4  TCP *:pptp (LISTEN)
master    1477167     root  IPv4  TCP *:smtp (LISTEN)
master    1477167     root  IPv6  TCP *:submission (LISTEN)
master    1477167     root  IPv4  TCP *:urd (LISTEN)
httpd     2714061   apache  IPv6  TCP *:https (LISTEN)
...

Table of Contents

 About This Book

 Introduction to Ubuntu Systems

 GNOME - Desktop Interface and Environment

 Shell - The Command-Line Interpreter

 Process Management

 Memory Management

 Files and Directories

 APT (Advanced Package Tool)

Network Connection on Ubuntu

 Connect to Wi-Fi with GNOME Settings

 "traceroute" - Trace Route to Remote Host

 "ifconfig" - Trace Routes to Remote Host

 "route" - Manage Routing Table

 "netstat" - Display Network Statistics

"lsof" - List of Open Files

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

 Administrative Tasks

 References

 Full Version in PDF/EPUB