What files is a specific process using?

Quick Linux Tip #6:

Try: lsof -p 3456

Info: lsof shows all files, sockets, and connections used by a process. Great for troubleshooting.

Examples:

  • $ lsof -p 3456
  • $ lsof -i :8080
  • $ lsof -u username

Note: Use -i for network connections. -i :PORT shows the process using that port.




LinuxTeck.com
linuxteck@ubuntu:~$ lsof -p 3456

COMMAND  PID  USER  FD  TYPE  NAME
firefox  3456 user  cwd DIR   /home/user
firefox  3456 user  txt REG   /usr/lib/firefox

linuxteck@ubuntu:~$

PREVIOUS ARTICLE Quick Linux Tip #05: How do I schedule tasks to run automatically? NEXT ARTICLE Quick Linux Tip #07: How do I speed up processing many files using all CPU cores?
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.