Created
November 6, 2016 07:35
-
-
Save picatz/cb45a86257a098bf52a5fe02af7f9eaa to your computer and use it in GitHub Desktop.
pseudo code of an lsof parser I'd like to have
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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