LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-06-2011, 04:37 PM   #1
ncn8ochaser
LQ Newbie
 
Registered: Nov 2010
Posts: 5

Rep: Reputation: 0
Question Viewing ONLY the "header" of the Top command - Ideas?


Alright, guys. This one has me stumped. I'm trying to create a cron job that displays ONLY the "header" from the Top command. So, I'd like to see this.

Code:
top - 09:14:09 up 270 days,  3:05,  1 user,  load average: 5.65, 4.74, 4.53
Tasks: 425 total,   2 running, 420 sleeping,   0 stopped,   3 zombie
Cpu(s): 35.6% us,  8.6% sy,  0.0% ni, 51.7% id,  4.1% wa,  0.0% hi,  0.0% si
Mem:   8306036k total,  6798252k used,  1507784k free,   475028k buffers
Swap: 15626944k total,     5044k used, 15621900k free,  5283860k cached

I've got the cron set up to do exactly what I want. It runs Top and uses sendEmail to shoot the information to me via email once every morning. It sends the whole output and that's great.

Problem is, when it sends to my mobile email, I can't read it. The formatting is FUBAR'ed so I'd like to see ONLY the header.


How can I make this happen? All I need is the command to display the header of Top, nothing more, nothing less.



Thanks any ideas!!
 
Old 02-06-2011, 04:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
top | head -n 5 | mail -s "top" account@mailhost.com
 
Old 02-06-2011, 05:50 PM   #3
ncn8ochaser
LQ Newbie
 
Registered: Nov 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
top | head -n 5 | mail -s "top" account@mailhost.com
Beautiful!!


Thanks a ton for the fast reply! This is working great!

Thanks again!
 
Old 02-06-2011, 06:35 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Most welcome ... :}



Cheers,
Tink

Last edited by Tinkster; 02-06-2011 at 06:53 PM. Reason: latency issues
 
  


Reply


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
Command logging ideas needed! ssh user@host "echo logme" ZiGz Linux - Security 6 04-15-2009 03:08 AM
Finding the top CPU-using processes? "top" command does not help... catalytical Linux - Server 1 04-06-2009 05:50 PM
"TOP" Command keeps going to "stopped" state mudtoe Linux - Newbie 3 03-10-2009 12:15 AM
difference between "ps" and "top" command idleBrain Linux - General 3 10-18-2008 06:03 AM
Viewing 132 column using "less" command kvvkumar Linux - Software 2 05-11-2007 11:37 PM


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

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