Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-01-2006, 06:47 AM   #1
Registered: May 2006
Posts: 70

Rep: Reputation: 15
CPU usage

Someone told me the following line to get the CPU temperature from the hardware monitoring command "sensors"


sensors | perl -ne 'if ( /CPU Temp:\s*\+(\d+)/ ) { print $1 . "\n"; }'

Im trying to get the the command line to show me just the CPU usage from the command "top"


top | perl ...............

I dont know what the code given to me means so cant modify it. Can anyone explain?

(This was received in another thread so i hope im not committing the crime of duplication here!
Its just that other thread gave me such cronic grief i gave up on it and hope to start afresh..)
Old 12-01-2006, 07:09 AM   #2
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You could try this:
top -n 1 |grep Cpu
There are probably better ways to get CPU usage than top though - top is quite heavy itself. One good measure of system load is the load average. See the uptime manual page.

I guess you're trying to write a system monitor eh? There are a lot already out there - maybe you can find some tips on how best to gather system info from their code. I like the name of this one.
Old 12-01-2006, 07:47 AM   #3
Registered: May 2006
Posts: 70

Original Poster
Rep: Reputation: 15
Yes. Thanks for that link. I didnt know there was a comprehensive one for linux.

Ive used speedfan and systems monitor in windows. Im tryin to get a similiar one up and running. Are ther any other good ones you know in linux?


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
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 09:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 05:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 06:55 AM
CPU Usage Jehos Programming 3 11-30-2003 06:46 AM
cpu usage Aldebaran Linux - Newbie 3 10-11-2003 12:57 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:21 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration