linux max open files

We can check the file descriptor limit and max open files using lsof commands in Linux. Learn the top 12 lsof commands. we can find a list of open files using this command in Linux. so

Learn Top 12 lsof Commands Example In Linux 8:

We can install and check the open files in Linux using lsof command in ubuntu as well as in Linux. If you see lsof command not found, you can install it. let’s see, how to use lsof using the examples.

yum install lsof -y

Example 1: Simply type lsof it will show you all the list of open files on the Linux machine. so

lsof | more

Check Out: How To Create IAM Users Account As Administrator In AWS Cloud

Example 2: List open files under a directory and with ‘+D’ it will show you the recurse the subdirectory if you don’t want it you can use ‘+d.

lsof +D /opt/apache-tomcat-10.0.0-M1/ | more

Check Out: Install and Configure AWS CLI Version 2 Tool On Windows

Example 3: List of open files by a user so

lsof -u root | more

Example 4: Check open files with process id and I have a running apache tomcat server and I found the process id using ps -ef | grep java

lsof -p 17265 | more

Check Out: How To Make EBS Volume To Use On AWS Cloud

Example 5: we can kill all the process that belongs to the users using lsof -t -u root | more and ‘t’ options displays the list of all process. so

Kill -9 ‘lsof -t -u root’

Example 6: List all Network connections using lsof -i

how to use lsof command

Check Out: How To Empty a Large File or Delete Them On Linux

Example 7: Find process running on ports using lsof -i TCP:22 so

linux count open files per process

Example 8: We can check only iv4 or ipv6 connections using lsof -i 4 or lsof -i 6 o

learn top 12 lsof

Check Out: How To Configure Autoscaling Setup On Amazon Cloud

Example 9: we can Exclude the user with ‘^’ character and displays the process.

lsof -i -u^root | more

lsof command

Example 10: List process that listening on a particular port.

lsof -I :22

Check Out: How To Recover lost Data Using Testdisk On Linux

Example 11: We can also list all UDP and TCP connections.

lsof -i udp

lsof open files

lsof -i tcp

 linux file descriptor limit

Example 12: you can list all NFS files using ‘-N’ options. 

lsof -N -u username -a

You’re done linux file descriptor limit max open files


Please enter your comment!
Please enter your name here