Skip to content

Instantly share code, notes, and snippets.

@picatz
Created November 6, 2016 07:35
Show Gist options
  • Save picatz/cb45a86257a098bf52a5fe02af7f9eaa to your computer and use it in GitHub Desktop.
Save picatz/cb45a86257a098bf52a5fe02af7f9eaa to your computer and use it in GitHub Desktop.
pseudo code of an lsof parser I'd like to have
# pseudo code of an lsof parser I'd like to have
require 'lsof_parser'
# -P : Do not resolve port names
# -n : Do not resolve hostnames
data = Lsof::Parser.new( :arguments => "-Pn" )
data.each do |data|
data.pid
# => #<Lsof::Pid:23466:0x0000000126910>
data.files
# => #<Lsof::Files:0x00000001c64480>
data.files.count
# => 70
data.listeners.count
# => 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment