1

If I use this grep MemTotal /proc/meminfo in linux terminal, I get MemTotal: 2059908 kB.

Does anybody know how to get numbers only? which will be 2059908?

1

3 Answers 3

1

One way is to filter the output with something like:

grep MemTotal /proc/meminfo | sed 's/[^0-9]//g' 

This will remove all characters that aren't digits, as per the following transcript:

pax:~$ grep MemTotal /proc/meminfo MemTotal: 4122788 kB pax:~$ grep MemTotal /proc/meminfo | sed 's/[^0-9]//g' 4122788 
Sign up to request clarification or add additional context in comments.

Comments

1

Try adding this: |awk '{print $2}'

Comments

1

besides looking at /proc/meminfo, any of the following commands on LINUX will help: free, top

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.