{"id":7518,"date":"2023-02-14T17:35:54","date_gmt":"2023-02-14T17:35:54","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=7518"},"modified":"2023-02-14T17:35:54","modified_gmt":"2023-02-14T17:35:54","slug":"lsof-command-not-found","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/02\/14\/lsof-command-not-found\/","title":{"rendered":"lsof: command not found"},"content":{"rendered":"\n<p>lsof command stands for List Of Open File. This command provides a list of files that are opened. Basically, it gives the information to find out the files that are opened by which process. If you encounter the below error while running the lsof command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nlsof: command not found\n<\/pre><\/div>\n\n\n<p>You may install the below package as per your choice of distribution.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><br>Debian-Ubuntu-Kali-Raspbian<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\napt-get install lsof\n<\/pre><\/div>\n\n\n<p>CentOS<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nyum install lsof\n<\/pre><\/div>\n\n\n<p> Fedora <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndnf install lsof\n<\/pre><\/div>\n\n\n<p>lsof Command Examples<\/p>\n\n\n\n<p>Running the lsof commands gives us a list of all the open files on the system. <\/p>\n\n\n\n<p>By using the -u option and specifying the username, we get a list of open files for a particular user. <\/p>\n\n\n\n<p>When we use the -i option and specify a port number, we get information about any process running on that port. <\/p>\n\n\n\n<p>When we use both the -i and -u options with a particular username, we get information about the files and commands being accessed by that user.<\/p>\n\n\n\n<p>Find the processes that have a given file open:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlsof path\/to\/file\n<\/pre><\/div>\n\n\n<p>Find the process that opened a local internet port<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nlsof -i :port\n<\/pre><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>lsof command stands for List Of Open File. This command provides a list of files that are opened. Basically, it gives the information to find out the files that are opened by which process. If you encounter the below error while running the lsof command: You may install the below package as per your choice &#8230; <a title=\"lsof: command not found\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2023\/02\/14\/lsof-command-not-found\/\" aria-label=\"Read more about lsof: command not found\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-7518","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/7518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=7518"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/7518\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=7518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=7518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=7518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}