fork(1) download
  1. require 'pathname' and Pathname('/proc/').children.group_by(&:ftype).each{ |type, files| files.first(10).each_with_index{ |file, index| lambda{ |file, type| "%-30s%-10s" % [file, type] }.tap{ |printer| if index.zero? then puts printer.call("path", "type") end or puts printer.call(file, "%s (%s)" % [type, files.size]) } } and (files.size - 10).tap{ |remain| if remain > 0 then puts "(another #{remain})\n\n" else puts end } };
Success #stdin #stdout 0.01s 6384KB
stdin
Standard input is empty
stdout
path                          type      
/proc/fb                      file (45) 
/proc/dma                     file (45) 
/proc/keys                    file (45) 
/proc/kmsg                    file (45) 
/proc/misc                    file (45) 
/proc/mtrr                    file (45) 
/proc/stat                    file (45) 
/proc/iomem                   file (45) 
/proc/kcore                   file (45) 
/proc/locks                   file (45) 
(another 35)

path                          type      
/proc/fs                      directory (9)
/proc/bus                     directory (9)
/proc/irq                     directory (9)
/proc/sys                     directory (9)
/proc/tty                     directory (9)
/proc/acpi                    directory (9)
/proc/driver                  directory (9)
/proc/sysvipc                 directory (9)
/proc/11449                   directory (9)

path                          type      
/proc/net                     link (4)  
/proc/mounts                  link (4)  
/proc/self                    link (4)  
/proc/thread-self             link (4)