- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Outputting top information to a text file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 05:43 AM
08-01-2007 05:43 AM
Outputting top information to a text file
I would like to use top to take a snapshot of a system's resource usage, and output the results to a text file. What arguments and/or options would I use with top to accomplish this? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 05:48 AM
08-01-2007 05:48 AM
Re: Outputting top information to a text file
# top -d 1 -f output_file
But I think you best look at the sar command for analyzing system performance.
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 05:48 AM
08-01-2007 05:48 AM
Re: Outputting top information to a text file
That will give you snapshot of a moment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 06:29 AM
08-01-2007 06:29 AM
Re: Outputting top information to a text file
Thanks for your reply. I completed writing the script, and here is the text of it:
# This script will run the top utility, and save the results to a text file.
# The text file will then be e-mailed to the system administrators.
# Change to the directory where the output file will be generated by this script.
cd /tmp
# Run the top utility as sudo user, and save the results to a text file.
sudo top -f topoutput.txt
# E-mail the outputfile that was generated, to the system administrators.
I changed the permissions on the script to make it executable, and then ran it. Unfortunately, I got an error on-screen that read: Word too long.
What is causing this error to occur, and how can I fix it? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 06:34 AM
08-01-2007 06:34 AM
Re: Outputting top information to a text file
# sh -x script_name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 06:51 AM
08-01-2007 06:51 AM
Re: Outputting top information to a text file
If I run the script with the syntax:
sh topmonitor
The script runs without a problem. It is just when I try to run it like so:
./topmonitor
That I get the error. The shell that I use is tcsh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 06:53 AM
08-01-2007 06:53 AM
Re: Outputting top information to a text file
#!/usr/bin/sh
Any reason you want to use tcsh?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 06:56 AM
08-01-2007 06:56 AM
Re: Outputting top information to a text file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2007 03:33 PM
08-01-2007 03:33 PM
Re: Outputting top information to a text file
sudo top -f topoutput.txt
I wasn't aware that top did anything different for root?? So why do that? (All it does is make topoutput.txt have different owners and there is nothing private with the top data.)