Help for this page

Select Code to Download


  1. or download this
           total    used  free shared  buffers  cached
    Mem:  189656  180144  9512      0     6976   81012
    
  2. or download this
       my @lines = `free`; # run command, store output
       chomp (@lines);     # remove all newlines.
    
  3. or download this
    my @field_names = split (' ', $lines[0]); # split 1st line
    
  4. or download this
    my @mem_sizes = ( $lines[1] =~ m/(\d+)/g );
    
  5. or download this
    my %free; # a hash, where the fields will get stored
    
  6. or download this
    @free { @field_names } = @mem_sizes;
    
  7. or download this
    print("Cached: ", $free{'cached'}, "\n");
    
  8. or download this
    @free { @field_names } = @mem_sizes;