Where is lsof in linux
If you like what you are reading, please consider buying us a coffee or 2 as a token of appreciation. We are thankful for your never ending support. Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published. Save my name, email, and website in this browser for the next time I comment. Notify me of followup comments via e-mail. You can also subscribe without commenting.
In this article, we have seen how to use the lsof command on the Linux system. We have implemented different examples for a better understanding of lsof command. Share with us your feedback via comments. Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications.
As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays. In the Linux environment, everything is considered as a file and managed in folders or directories. So, while working on the Linux operating system, there might be numbers of folders and files that are being utilized; some of them would be visible for users, and others may be hidden.
Pre-requisites You must be login as a root user on your system or must have sudo command privillages. The -i switch of the command allows you to find a process or application which listens to a specific port number. In the example below, I checked which program is using port For example, which application is using port 25 TCP:. The utility also allows you to list open files based on a specific port or port range.
For example, to display open files for port , use the following command:. The tool allows you to list files based on the type of connection. For example, for UDP specific files, use the following command:.
The option in question is -R. By using a combination of the -i and -u command-line options, we can search for all network connections of a Linux user. This can be helpful if you inspect a system that might have been hacked. In this example, we check all network activity of the user www-data:. Although lsof offers a plethora of options, the ones we've discussed here should be enough to get you started.
Once you're done practicing with these, head to the tool's man page to learn more about it. Oh, and in case you have any doubts and queries, drop in a comment below. Great article! This feature is only available to subscribers. Get your subscription here. Log in or Sign up. Linux is a brilliant multi-user platform. Multiple users can access the system at the same time and perform operations that they have permission for.
How about checking out all the commands and files a certain user is accessing? Run the following one. This method can also be used to show all the processes that are using ports within a certain range, for example, 1 to
0コメント