Linux lsof command.

LiSt Open Files (LSOF) is an excellent utility for managing and tracking network connections on your Linux system.
This utility allows you to see what program is operating on an open port, which daemons have established connections, and what ports are open on your server.
You can list open ports, identify connections currently being made to your system, and determine what resources a process is using.
Also, on many Linux systems, LSOF will be installed by default.
Let’s see some example and how this means.

The lsof -i command lists all open files associated with Internet connections.
By default, LSOF lists detailed information about each connection.

List all open Internet files.

This allows you to watch on your system with an output change over time.

This list all NFS files in use.

This unmounting a partition, in this case, sda1.

This kills each process, or users to free the partition.

List all connection on your server opened. The output will not be the same for the root user.

List all files on your server used by your_user.

Find all open files by the program’s name. For example firefox.

You can use ^ translate by except to find all files open by all processes except PID 2628.

Count the files opens by all processes except PID 2628.

List all opened files by httpd run by root

List all opened files by firefox inside /home/your_user/ folder.

Shows you all open files that have a link count less than 1

Also, shows you all open files are opened by a program which doesn’t exist in the file system.
You can manually kill/terminate these processes to free up the memory.
The last example is about your program and ports.

The output will be GoogleTalkPlugin.I think it does not work properly with Linux, is just my opinion.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.