lsof – list open files.

lsof – list open files for more information, please see the man page 😉

List process running on a port
root# lsof -i :port_number

Lists IPv4, use 6 for IPv6
root# lsof -i 4

Lists open files for TCP port ranges 1-1024
root# lsof -i :1-1024

Lists by pid
root# lsof -p PID

List files opened by a specific user
root# lsof -u username

Kill all activity for a particular user
root# killall -9 `lsof -t -u username`

List all network connections
root# lsof -i

List the opened files in a directory
root# lsof +D path_of_the_directory

List the opened files based on process names
root# lsof -c process_name

Leave a Reply

Your email address will not be published. Required fields are marked *