Show Menu

lsof commands Cheat Sheet by

lsof commands

Show networking on a port

lsof -iTCP -i :port
lsof -i :22

Show connec­tions to a host

Find ports that are being listened to

lsof -i| grep LISTEN

find files open by user

lsof -u <us­er>

find files open by command

lsof -c <co­mma­nd>

find files open by proccess id

lsof -p <pi­d>


get list of processes in use by command
lsof -t -c <co­mma­nd>
kill processes open by command
kill -HUP $(lsof -t -c <co­mma­nd>)
kill processes open by user
kill -9 $(lsof -t -u <us­er>)


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          tmux the terminal multiplexer Cheat Sheet
          Awesome Window Manager 3.x Cheat Sheet
          lsof Cheat Sheet