Tuesday, August 24, 2010


Below are some of my favorite lsof combination which I found so handy and proves savior in critical moment. Just an effort to put them in this single page.

lsof -d mem Programs loaded in memory and executing
lsof -i :25 Who is using this port
lsof -i lists all processes with open Internet sockets (TCP and UDP)
lsof -c httpd listing of files for processes whose name begins with apache(httpd)
lsof -N Listing of NFS mounted files
lsof -u ^root| grep debu List all open files by a user exclude root user.
lsof -p 3030 list by pid, you can supply more than one with a comma separated list
lsof /tmp/funky.lock To find the processes that have the /tmp/funky.lockfile open.
lsof -u only for specified uid
lsof -t `which httpd` List the PIDs of running httpd processes
lsof -i@ To see connection to a specific host
lsof -i| grep LISTEN What ports are listening for connection
lsof -i| grep ESTABLISHED Current Active connections
lsof /var/log/messages Which processes are interacting with this file
lsof +L1 Security context. This means something fishy. Read man page/google
lsof -i -P | grep -i "listen" List all open ports and their owning executables

There are some good resources too on how to recover deleted files with the help of lsof.
Paste below if you some more interesting lsof combination.


No comments:

Post a Comment

Why Database CI/CD?

Making the Database Part of Your Continuous Delivery Pipeline The database, unlike other software components and code or compiled co...