linux max open files

Learn Top 12 lsof Commands Example In Linux 8

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

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

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

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

linux count open files per process

Check Out: How To Configure Autoscaling Setup On Amazon Cloud

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

learn top 12 lsof

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

lsof -i -u^root | more

lsof command

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

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

lsof -I :22

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

Rate this article

Leave a Reply

Notify of