-   Linux - Newbie (
-   -   Viewing ONLY the "header" of the Top command - Ideas? (

ncn8ochaser 02-06-2011 03:37 PM

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.


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!!

Tinkster 02-06-2011 03:49 PM

top | head -n 5 | mail -s "top"

ncn8ochaser 02-06-2011 04:50 PM


Originally Posted by Tinkster (Post 4250243)
top | head -n 5 | mail -s "top"


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

Thanks again!

Tinkster 02-06-2011 05:35 PM

Most welcome ... :}


All times are GMT -5. The time now is 11:06 AM.