Windows openfiles equivalent in Linux
Shows which files, sockets, and devices are currently open and by which processes.
openfiles
lsof
lsof
lsof
Overview
What this command does
On Windows, "openfiles" is used to list open files and which process uses them. On Linux, the closest practical mapping shown here is "lsof". Shows which files, sockets, and devices are currently open and by which processes. This reference is grouped under Services & Processes → Processes.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows openfiles maps to lsof for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
For the broader concept behind this mapping, read Linux services and processes.
Practical tasks
Common use cases
List open files and which process uses them
Shows which files, sockets, and devices are currently open and by which processes.
lsof -u john
Files opened by user john
lsof -p 1234
Files opened by process 1234
lsof /var/log/syslog
Who has this file open?
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
lsof -i :80
lsof -p $(pidof nginx)
lsof /var/log/app.log
Walkthrough
Examples with explanations
# Windows: openfiles /query
# What process is using port 80?
lsof -i :80
# What files does nginx have open?
lsof -p $(pidof nginx)
# Who has this log file open?
lsof /var/log/app.log
Reference
Common options and variations
| Command or option | Use |
|---|---|
lsof -u john | Files opened by user john |
lsof -p 1234 | Files opened by process 1234 |
lsof /var/log/syslog | Who has this file open? |
lsof -i :80 | What process is using port 80? |
lsof -i tcp | All open TCP connections |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "lsof" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | lsof |
Same command on this distribution. |
| Fedora | same command | lsof |
Same command on this distribution. |
| Arch | same command | lsof |
Same command on this distribution. |
Keep learning