18 Quick ‘lsof’ command examples for Linux Geeks

3 Responses

  1. Alex E says:

    Example 3 isn’t throwing an error because you’re calling it on itself, it’s throwing an error because you’re calling it on a non-existent file. Type any garbage file name there and you’ll get the same result.

    lsof /usr/bin/lsof works just fine.

  2. Cyril says:

    Nice article.

    Although example #18 could be better written with the PIDs passed through a sub-command:

    # ps -fp “$(lsof -t /var/log/httpd/access_log | xargs echo)”

    instead of having to grep all pids, and then yet another one to exclude the first grep

Leave a Reply

Your email address will not be published. Required fields are marked *