Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-15-2014, 04:13 PM   #1
LQ Newbie
Registered: Oct 2014
Posts: 3

Rep: Reputation: Disabled
Get total cpu usage, total memory usage and available memory


I would like to know which command to get cpu usage percentage without any further info such as : 25% than how to get memory used in mega bytes and total available memory ?

Thank you.
Old 11-15-2014, 05:36 PM   #2
Registered: Oct 2014
Posts: 39

Rep: Reputation: Disabled
CPU Percentage - taken from
top -bn1 | grep "Cpu(s)" | \
sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \
awk '{print 100 - $1"%"}'
Copy and paste this code in your terminal. Your cpu usage will be calculated to a percentage used.

Memory - taken from
free -g


free -m
-m shows in megabytes
-g shows in gigabytes

I generally use top by itself for an overall analysis of the current session. BTW, top defaults to showing one CPU. To see all CPUs/cores in top, press the number 1 1 again to return to the default. For other options within top, press the ? mark.

Welcome to LQ

Last edited by whois; 11-15-2014 at 06:15 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find total memory usage of a program? Uni616 Linux - Newbie 3 09-22-2010 10:43 PM
How to find total apache memory usage? j0hnsmith Linux - Server 7 09-13-2010 03:49 AM
Query: Embedded System - Total Memory Usage EmbeddedSteve Linux - Embedded & Single-board computer 1 08-20-2010 01:40 PM
most, er, universal way to get system memory total and usage lumix Linux - Newbie 1 06-03-2007 10:30 AM
Limiting the total amount of memory usage by apache. Linux - General 8 08-30-2002 10:56 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:26 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration