Jump to content
Sign in to follow this  
Maze

how to capture the output of the top command into a file.

Recommended Posts

hello dear community

 

I’m trying to capture the output of the top command into a file. When I execute top > output.txt, the output.txt file contains lot of junk characters. What is the best method to capture the output of the top command into a readable text file?

i tried to use the top command batch mode operation option ( -b ) to capture the top command output into a file.



top -n 1 -b > top-output.txt

 

or this one

less top-output.txt

but - unfotunatly they do not work for me... :


linux-a9sq:/home/martin # -n 1 > top-output.txt
-n: command not found
linux-a9sq:/home/martin # top-output.txt
If 'top-output.txt' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf top-output.txt
linux-a9sq:/home/martin # top -n 1 -b > top-output.txt
linux-a9sq:/home/martin # top -n1 -b | head5
If 'head5' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf head5
linux-a9sq:/home/martin #

what can i do!?

 

love to hear from you

 

greetings

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.