"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

herong@mail ~]$ sudo 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 Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

Network Connection on CentOS

 Setup Ethernet Connection on CentOS

 Network Firewall Tools on CentOS

 "firewalld" and "firewall-cmd" on CentOS

 Manage Multiple Firewall Zones

 "nftables" and "nft" on CentOS

 "iptables" Command on CentOS

 "nmap" - Network Mapper on CentOS

 Monitor Network Services on CentOS

 "ifconfig" - Trace Routes to Remote Host

 "traceroute" - Trace Routes to Remote Host

 "route" - Upate Routing Table

 "netstat" - Display Network Statistics

"lsof" - List of Open Files

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB