shell - Linux command for physical memory, getting the value only -


in linux cat /proc/meminfo | grep memtotal gets memtotal: 12298824 kb

i want numbers here

so wrote cat /proc/meminfo | grep memtotal | cut -d':' -f2 gave me 12298824 kb

i want numbers here, can me?

note: cat /proc/meminfo | grep memtotal | cut -d':' -f2 | cut -d'k' -f1 gives me solution 12298824, there better way? 1 liner?

use awk:

cat /proc/meminfo | grep memtotal | awk '{print $2}' 

from @lars wirzenius's comment(no cat , no grep):

awk '/memtotal/ { print $2 }' /proc/meminfo 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -