News for hackers. Stuff that matters.
Re:A Unix Utility to Know About: lsof (2009) by nailer on Friday August 26, 2016 @03:58AM (#12364886)
For finding what uses a file, I'm an 'fuser' kid but lsof is fine too. Using posh right now, so had to make my own:

    function fuser($relativeFile){
      $file = Resolve-Path $relativeFile
      foreach ( $Process in (Get-Process)) {
        foreach ( $Module in $Process.Modules) {
          if ( $Module.FileName -like "$file*" ) {
            $Process | select id, path
          }
        }
      }
    }
In use:

    > fuser .\node_modules\

      Id Path
      -- ----
    2660 C:\Program Files\nodejs\node.exe
Since it's object pipelining, you can:

    > fuser .\node_modules\ | kill
Re:A Unix Utility to Know About: lsof (2009) by smhenderson on Friday August 26, 2016 @09:24AM (#12366019)
I find myself using lsof for it's ability to show me what TCP sockets are in use more than what actual files are open.

lsof | grep TCP

Re:A Unix Utility to Know About: lsof (2009) by Terr_ on Friday August 26, 2016 @04:56PM (#12369242)
For that I often use:

netstat --ip -a -p

Those particular options mean to show just IP ports (UDP/TCP), in all statuses (active, listening) and to display the local process which is involved.