

{"id":109352,"date":"2022-07-30T09:00:26","date_gmt":"2022-07-30T03:30:26","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=109352"},"modified":"2022-07-30T09:19:43","modified_gmt":"2022-07-30T03:49:43","slug":"lsof-command-in-linux","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/","title":{"rendered":"LSOF Command in Linux"},"content":{"rendered":"<p>In this article, you will learn what LSOF is, and why the command is used in Linux. We will also be looking into the practical use of the LSOF command as we go through the syntax, options, and even a few examples of how to use it.<\/p>\n<h3>What is LSOF Command in Linux?<\/h3>\n<p>LSOF is a command-based Linux utility that is an acronym for List of Open Files. As the name suggests, its main function is to retrieve details about various types of files opened by different running processes.<\/p>\n<p>The LSOF tool was supported and developed by Victor A Abell. He was a retired associate director of the Prude University computing center.<\/p>\n<p>The LSOF command can not only list common or regular files but it can also perform tasks like listing things like a shared library, special file, a named pipe, regular pipe, a character special file, and many more.<\/p>\n<h3>Why use LSOF?<\/h3>\n<p>By now, we all know that in Linux-based operating systems, the kernel considers everything as a file, things like pipes, sockets, directories, services, and many more are taken as files by the kernel. One of the many reasons we use LSOF is when a disk cannot be unmounted as it says the files are being used, However, with the help of LSOF, we can easily identify the files which are in use.<\/p>\n<p>With the help of LSOF, we can find the different processes like:<\/p>\n<p>1. Retrieve information about opened files<\/p>\n<p>2. Listing all files a process is locking<\/p>\n<p>3. Lock up a file or directory<\/p>\n<p>4. List a process listening on a port<\/p>\n<p>5. Identify files that are in use<\/p>\n<p>And many more tasks.<\/p>\n<h3>How to install LSOF<\/h3>\n<p>LSOF is already available on some Linux distributions, ut not available in most. Don\u2019t worry, in typical Linux fashion, you can install LSOF with just 1 command.<\/p>\n<h4>Installing LSOF on Debian-based Linux distros<\/h4>\n<p>To download the LOSF tool in Debian-based Linux distributions like Ubuntu, kali, Deepin, PureOS, AntiX, ParrotOS, and many more, you can use the command shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo apt install lsof<\/pre>\n<h4>Installing LSOF on RHEL and Fedora-based Linux distros<\/h4>\n<p>To download the LSOF utility in Red hat based distros like Rocky Linux, Alma Linux, CentOS, Fedora, Oracle Linux, Clear OS, and many more, or on Fedora-based Linux distros (RHEL and fedora are almost the same, as Fedora is an upstream version of RedHat), you can do so by using the command shown below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo yum install lsof<\/pre>\n<p>If at all you want to install using the \u201cDNF\u201d command in the same distros, you can do so by typing the command shown below in the terminal:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sudo dnf install lsof<\/pre>\n<h3>Syntax of Linux LSOF command<\/h3>\n<p>Now that you know how to install the tool, let us see the syntax it is used in. The syntax of the LSOF tool is very simple:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">lsof &lt;option&gt; &lt;username&gt;<\/pre>\n<h3>Options with Linux LSOF command<\/h3>\n<p>The first field in the syntax is the options we need to enter to get th desired results about the files or to perform actions on the files. Let us first look into the options to provide a better understanding, before we look at some examples of how to use the LSOF command.<\/p>\n<p><strong>1. -? \/ -h<\/strong><\/p>\n<p>These two options display a shortened version of all the uses of the options in the LSOF command<\/p>\n<p><strong>2. -a<\/strong><\/p>\n<p>This option makes the list selection options to be ANDed<\/p>\n<p><strong>3. -A A<\/strong><\/p>\n<p>This option is available on systems configured for AFS. This option allows the LSO user to specify \u2018A\u2019 as an alternate name list file where the kernel of the addresses of the dynamic modules might be found.<\/p>\n<p><strong>4. -b<\/strong><\/p>\n<p>This option makes LSOF avoid kernel functions that block stat, readlink, and lstat.<\/p>\n<p><strong>5. -cc<\/strong><\/p>\n<p>This option selects the listing of files for processes executing the command that begins with the characters of c.<\/p>\n<p><strong>6. +c w<\/strong><\/p>\n<p>This option defines the maximum number of initial characters of the name supplied by the UNIX dialect.<\/p>\n<p><strong>7. -C<\/strong><\/p>\n<p>This option disables the ratio of the components of the paths names of the kernel name cache<\/p>\n<p><strong>8. d+&lt;directory name&gt;<\/strong><\/p>\n<p>This option tells LSOF to search for all the open instances of the directories name you specify and the files and directories it contains in the first level<\/p>\n<p><strong>9. -ds<\/strong><\/p>\n<p>This option selects the listing of files whose descriptors are present in all s comma-separated. Note that there should not be any spaces in the set.<\/p>\n<p><strong>10. -D+&lt;directory name&gt;<\/strong><\/p>\n<p>This option searches for all open instances of the directory name you specified and all files and directories it contains to its maximum depth.<\/p>\n<p><strong>11. -F f<\/strong><\/p>\n<p>This option specifies a list of characters you specified, that selects the fields to go out for treatment with another program, and the character that terminates each output field.<\/p>\n<p><strong>12. -g&lt;c&gt;<\/strong><\/p>\n<p>This option selects the listing of files for the processes whose number IDentification process group (group ID) is present in all \u201cc\u201d comma-separated. Note that there should not be any space.<\/p>\n<p><strong>13. -i&lt;internet address&gt;<\/strong><\/p>\n<p>This option selects the listing of files whose Internet address matches the address specified you specified.<\/p>\n<p><strong>14. -k&lt;kernel name list file&gt;<\/strong><\/p>\n<p>This option specifies a kernel name list file you specified, instead of \/vmunix, \/mach, etc.<\/p>\n<p><strong>15. -i<\/strong><\/p>\n<p>This option prevents the user ID conversion to log in.<\/p>\n<p><strong>16. -m m<\/strong><\/p>\n<p>This option specifies a kernel memory file, c instead of \/dev \/kmem or \/dev\/mem<\/p>\n<p><strong>17. -not<\/strong><\/p>\n<p>This option prevents the conversion of network numbers (decimal places) to hostnames for network files.<\/p>\n<p><strong>18. -NOT<\/strong><\/p>\n<p>This option selects the listing of NFS (network file system) files.<\/p>\n<p><strong>19. -o<\/strong><\/p>\n<p>This option displays the position (offset) in the file.<\/p>\n<p><strong>20. 0&lt;number&gt;<\/strong><\/p>\n<p>This option sets the number of decimal digits you specify to display after &#8220;0t&#8221; for a position in a file before it passes to the form &#8220;0x &#8230;&#8221;.<\/p>\n<p><strong>21. -O<\/strong><\/p>\n<p>This option avoids the strategy it uses to avoid being blocked by some kernel operations.<\/p>\n<p><strong>22. p&lt;c&gt;<\/strong><\/p>\n<p>This option selects the listing of files for the processes whose ID numbers are present in all comma-separated \u201cc\u201d.<\/p>\n<p><strong>23. -P<\/strong><\/p>\n<p>This option prevents the conversion of port numbers to port names for network files<\/p>\n<p><strong>24. -R<\/strong><\/p>\n<p>This option lists the ID numbers of parent processes in the PPID (Parent Process IDentification number) column.<\/p>\n<p><strong>25. -s<\/strong><\/p>\n<p>This option displays the file size.<\/p>\n<p><strong>26. -S&lt;t&gt;<\/strong><\/p>\n<p>This option specifies an optional timeout value for kernel functions like readlink, lstat, and stat &#8211; that might otherwise lead to a deadlock (a deadlock is where 2 or more processes are waiting for each other as they are competing for resources)<\/p>\n<p><strong>27. -T&lt;t&gt;<\/strong><\/p>\n<p>This option controls the information report TCP \/ TPI, also reported by netstat, following the network addresses.<\/p>\n<p><strong>28. -t<\/strong><\/p>\n<p>This option specifies that lsof should produce terse output with process identifiers only and no header.<\/p>\n<p><strong>29. -u&lt;c&gt;<\/strong><\/p>\n<p>This option selects the listing of files for users whose name or user ID is present in all comma-separated \u201cc\u201d.<\/p>\n<p><strong>30. -U<\/strong><\/p>\n<p>This option selects the listing of UNIX domain socket files.<\/p>\n<p><strong>31. -v<\/strong><\/p>\n<p>This option displays the version of the LSOF you are using, including information like revision number, construction date, the identity of the builder and construction location, the name of the compiler used, and a lot more.<\/p>\n<p><strong>32. -V<\/strong><\/p>\n<p>This option indicates the items it was asked to list and has not found.<\/p>\n<p><strong>33. -X<\/strong><\/p>\n<p>This option is dialect-specific.<\/p>\n<p>If at all you feel that you need help or want to see all of these options at a glance, you can always type the command \u201clsof -?\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-help.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109471\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-help.webp\" alt=\"lsof help\" width=\"1009\" height=\"898\" \/><\/a><\/p>\n<h3>Output fields<\/h3>\n<p>Before we see the examples of how to use the LSOF command, it is important to understand the format in which the output is printed and understand what each of the output fields means.<\/p>\n<p>The LSOF outputs field structure is as shown below<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/output-fields-of-lsof.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109472\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/output-fields-of-lsof.webp\" alt=\"output fields of lsof\" width=\"1591\" height=\"36\" \/><\/a><\/p>\n<p>Most of the fields are self-explanatory except for the field \u201cFD\u201d and \u201cTYPE\u201d<\/p>\n<p>\u201cFD\u201d stands for the File Descriptor number of the file and \u201cTYPE\u201d refers to the type of node associated with the file.<\/p>\n<p>The \u201cFD\u201d field can contain the following values:<\/p>\n<p>1. cwd &#8211; current working directory<\/p>\n<p>2. Lnn &#8211; Library references<\/p>\n<p>3. err &#8211; FD information error<\/p>\n<p>4. jld &#8211; Jail director<\/p>\n<p>5. ltx &#8211; shared library text<\/p>\n<p>6. Mxx &#8211; hex memory-mapped type number<\/p>\n<p>7. m86 &#8211; DOS merge map failed<\/p>\n<p>8. mem &#8211; memory-mapped file<\/p>\n<p>9. mmap &#8211; memory-mapped device<\/p>\n<p>10. pd &#8211; parent directory<\/p>\n<p>11. rtd &#8211; root directory<\/p>\n<p>12. tr &#8211; kernel trace file<\/p>\n<p>13. txt &#8211; program text<\/p>\n<p>14. v86 &#8211; VP\/ix mapped file<\/p>\n<p>Similarly, the \u201cTYPE\u201d file can contain:<\/p>\n<p>1. GDIR<\/p>\n<p>2. GREG<\/p>\n<p>3. VDIR<\/p>\n<p>4. VREG<\/p>\n<p>5. IPV4<\/p>\n<p>6. IPv6<\/p>\n<p>7. REG<\/p>\n<p>8. DIR<\/p>\n<p>9. a_inode<\/p>\n<p>10. CHR<\/p>\n<h3>Examples of LSOF commands<\/h3>\n<p>Now that you know the syntax, the format in which the output is printed, the different options, and what they do, let us look at some examples of how to use the LSOF tool.<\/p>\n<h4>1. Listing all open files<\/h4>\n<p>To list all the running files that are currently open by active processes, type the command \u201csudo lsof | less\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-all-open-files.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109473\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-all-open-files.webp\" alt=\"listing all open files\" width=\"1073\" height=\"749\" \/><\/a><\/p>\n<h4>2. Listing user-specific opened files<\/h4>\n<p>If you want to list all the opened files of a specific user, you can do so by typing the command \u201csudo lsof -u &lt;username&gt;\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-user-specific-opened-files.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109474\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-user-specific-opened-files.webp\" alt=\"listing user specific opened files\" width=\"1028\" height=\"784\" \/><\/a><\/p>\n<h4>3. Listing by a filename<\/h4>\n<p>If you wish to list all the processes that have opened a specific file, you can do so by typing the command \u201csudo lsof &lt;filename&gt;\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-by-a-filename.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109475\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-by-a-filename.webp\" alt=\"listing by a filename\" width=\"1041\" height=\"225\" \/><\/a><\/p>\n<h4>4. Listing open files by process<\/h4>\n<p>To list files opened by a particular process, use the command<\/p>\n<p>\u201csudo lsof -c &lt;process name&gt;\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-by-process.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109476\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-by-process.webp\" alt=\"listing open files by process\" width=\"1357\" height=\"398\" \/><\/a><\/p>\n<h4>5. Searching by PID<\/h4>\n<p>You can also list files opened by a process by using the process ID, instead of the process name. To do so you have to use the fag \u201c-p\u201d, to specify the ID of the process. You can list the process by its PID by using the command<\/p>\n<p>\u201cSudo lsof -p &lt;process ID&gt;\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/searching-by-pid.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109477\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/searching-by-pid.webp\" alt=\"searching by pid\" width=\"1252\" height=\"740\" \/><\/a><\/p>\n<h4>6. Listing open files containing directory<\/h4>\n<p>If you wish to list processes that opened files under a specific directory, use \u201c+D\u201d option followed by directory path.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-containing-directory.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109478\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-containing-directory.webp\" alt=\"listing open files containing directory\" width=\"1746\" height=\"400\" \/><\/a><\/p>\n<h4>7. Repeat mod of LSOF<\/h4>\n<p>The LSOF tool can also be run in repeat mode, where LSOF will generate and print output at regular intervals.<\/p>\n<p>There are 2 repeat modes supported by LSOF, one with the option \u201c-r\u201d and the other with the option \u201c+r\u201d<\/p>\n<p>The \u201c-r\u201d option makes LSOF repeat to execute until it receives an interrupt\/kill signal from the user.<\/p>\n<p>The \u201c+r\u201d option makes LSOF repeat mode end as soon as its output has no open files.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/repeat-mod-of-lsof.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109479\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/repeat-mod-of-lsof.webp\" alt=\"repeat mod of lsof\" width=\"1174\" height=\"642\" \/><\/a><\/p>\n<p>The command in the picture prints the files opened by a process in the user \u201cgopi kiran\u201d, with command \u201cbash\u201d and directory \u201c\/usr\/lib\u201d every 3 seconds.<\/p>\n<h4>8. Listing open files within the network protocol<\/h4>\n<p>If you wish to list any type of Linux files which includes network sockets etc. We can list details of open network connections using \u201c-i\u201d flag.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-within-the-network-protocol.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109480\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-within-the-network-protocol.webp\" alt=\"listing open files within the network protocol\" width=\"1313\" height=\"381\" \/><\/a><\/p>\n<p>You can narrow down your search by specifying other fields using different flags.<\/p>\n<h4>9. Listing open files by port<\/h4>\n<p>We can filter the output of lsof with the \u201c-i\u201d flag by port number by using the command \u201csudo lsof -i :&lt;port number&gt;\u201d<\/p>\n<p>For example, if you want to list the open file in the port 22, you can do so by using the command \u201csudo -i :22\u201d<\/p>\n<h4>10. Listing files by IPv4 \/ IPv6 addresses<\/h4>\n<p>To filter network connections by limiting them to either IPV6 or IPv4, we use the following commands:<\/p>\n<p>For IPv4: \u201csudo lsof -i4\u201d<\/p>\n<p>For IPv6: \u201csudo lsof -i6\u201d<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-files-by-ipv4-addresses.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109481\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-files-by-ipv4-addresses.webp\" alt=\"listing files by ipv4 addresses\" width=\"1772\" height=\"364\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-files-by-ipv6-addresses.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109482\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-files-by-ipv6-addresses.webp\" alt=\"listing files by ipv6 addresses\" width=\"1621\" height=\"257\" \/><\/a><\/p>\n<h4>11. Listing open files on NFS<\/h4>\n<p>LSOF command can also list all NFS files currently open by a user.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-on-nfs.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-109483\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/listing-open-files-on-nfs.webp\" alt=\"listing open files on nfs\" width=\"862\" height=\"40\" \/><\/a><\/p>\n<h4>12. Listing Locked deleted files<\/h4>\n<p>Sometimes, Linux deleted some files, but they are still being locked by one or more processes. These files don\u2019t list on the normal file system, but they still take up disk space. This happens especially for large files deleted on purpose to clear disk space without releasing the process lock.<\/p>\n<p>To find such processes, you can combine LSOF with GREP and use the following command: \u201csudo lsof &lt;path&gt; | grep deleted\u201d<\/p>\n<p>&nbsp;<\/p>\n<h3>Summary<\/h3>\n<p>As you have seen, LSOF offers a large variety of options to narrow down and optimize your output. It is very helpful in day-to-day system and network administration tasks. You have learned what LSOF is, why it is used, the syntax of LSOF command in Linux, and some practical examples of how to use the LSOF tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, you will learn what LSOF is, and why the command is used in Linux. We will also be looking into the practical use of the LSOF command as we go through&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":109367,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[26883,26882,26881],"class_list":["post-109352","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-install-lsof","tag-lsof","tag-lsof-command-in-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>LSOF Command in Linux - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn what LSOF is, and why this command is used in Linux. See the practical use of LSOF command with its syntax, options, and examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LSOF Command in Linux - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn what LSOF is, and why this command is used in Linux. See the practical use of LSOF command with its syntax, options, and examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-30T03:30:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-30T03:49:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-linux-command.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"LSOF Command in Linux - DataFlair","description":"Learn what LSOF is, and why this command is used in Linux. See the practical use of LSOF command with its syntax, options, and examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"LSOF Command in Linux - DataFlair","og_description":"Learn what LSOF is, and why this command is used in Linux. See the practical use of LSOF command with its syntax, options, and examples.","og_url":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2022-07-30T03:30:26+00:00","article_modified_time":"2022-07-30T03:49:43+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-linux-command.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"LSOF Command in Linux","datePublished":"2022-07-30T03:30:26+00:00","dateModified":"2022-07-30T03:49:43+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/"},"wordCount":2025,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-linux-command.webp","keywords":["install lsof","lsof","LSOF Command in Linux"],"articleSection":["Linux Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/","url":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/","name":"LSOF Command in Linux - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-linux-command.webp","datePublished":"2022-07-30T03:30:26+00:00","dateModified":"2022-07-30T03:49:43+00:00","description":"Learn what LSOF is, and why this command is used in Linux. See the practical use of LSOF command with its syntax, options, and examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-linux-command.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/04\/lsof-linux-command.webp","width":1200,"height":628,"caption":"lsof linux command"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/lsof-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Linux Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"LSOF Command in Linux"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/109352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=109352"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/109352\/revisions"}],"predecessor-version":[{"id":109486,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/109352\/revisions\/109486"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/109367"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=109352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=109352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=109352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}