def free_physmem():
 out = sh('free -b')
 lines = out.split('\n')
 for line in lines:
  if line.startswith('Mem'):
   (total, used, free, shared) = [int(x) for x in line.split()[1:5]]
   nt = collections.namedtuple('free', 'total used free shared output')
   return nt(total, used, free, shared, out)
 raise ValueError(("can't find 'Mem' in 'free' output:\n%s" % '\n'.join(lines)))

def free_physmem ( ) : out = sh ( 'free -b' ) lines = out . split ( '\n' ) for line in lines : if line . startswith ( 'Mem' ) : ( total , used , free , shared ) = [ int ( x ) for x in line . split ( ) [ 1 : 5 ] ] nt = collections . namedtuple ( 'free' , 'total used free shared output' ) return nt ( total , used , free , shared , out ) raise ValueError ( ( "can't find 'Mem' in 'free' output:\n%s" % '\n' . join ( lines ) ) )
parse free cmd and return physical memorys total .