Wednesday, September 2, 2020

lsof command within Linux

The lsof command within Linux by default lists open files.  But the command can also show open network ports.  The example below returns any process with the name "team":

sudo lsof -i | grep "team"



Below is an example to show any process using the TCP port 5939:

sudo lsof -i TCP:5939


The next example shows processes that have listening ports:

sudo lsof -i | grep "LISTEN"


Additional examples can be found at https://www.linuxtechi.com/lsof-command-examples-linux-geeks/.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.