lsof command
List open files and the processes that hold them, including network ports.
- Processes & services
- Package lsof
- 6 options · 5 examples
On this page
Syntax
lsof [options]Provided by the lsof package. Run man lsof for the full manual.
Common options
| Option | What it does |
|---|---|
-i :PORT | Processes using a port |
-i TCP | TCP connections |
-u USER | Files a user has open |
-p PID | Files a process has open |
-t | Print PIDs only |
+D DIR | Open files under a directory |
Examples
What is using port 8080
sudo lsof -i :8080PIDs only (for kill)
sudo lsof -t -i :8080Open files of a process
sudo lsof -p 1234Who has a file open
sudo lsof /var/log/syslogDeleted files still taking space
sudo lsof | grep deleted
No example matches. Check the options table or search the guides.
