LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-13-2011, 06:52 PM   #1
humla
LQ Newbie
 
Registered: Apr 2011
Distribution: Ubuntu 10.10
Posts: 3

Rep: Reputation: 0
Output of htop in a file


Okay, need some some outputting the result of a command in the terminal. Tried using

command > resultfile

but this works with commands like ls which provide a result line by line. But for commands like top, htop and some other the text file adds some string of characters.
Example of running htop > test.txt is shown in the attached image. Anybody know how I can remove those characters and get something useful.

http://i51.tinypic.com/2igepgm.jpg
 
Old 04-14-2011, 12:27 PM   #2
jcalzare
Member
 
Registered: Aug 2009
Location: Chicago
Distribution: CentOS
Posts: 114

Rep: Reputation: 34
I think this is an issue of character encoding in the output of htop. I've tested this and it works just fine:

Code:
htop > test.txt
recode utf-8 test.txt
cat text.txt
Or, you can put it all in-line:

Code:
htop | recode utf-8 > test.txt
cat test.txt
 
Old 04-14-2011, 02:03 PM   #3
humla
LQ Newbie
 
Registered: Apr 2011
Distribution: Ubuntu 10.10
Posts: 3

Original Poster
Rep: Reputation: 0
thanks, i will try this and get back to you.

EDIT: Tried it and didn't seem to work, don't know why. Just to be clear its not the square with circles i need to get rid of, its the "[39m].." and "(B.."
The boxes are just spaces or tabs.

Sorry if i wasn't clear in the beginning.

Last edited by humla; 04-14-2011 at 02:15 PM.
 
Old 04-14-2011, 03:04 PM   #4
jcalzare
Member
 
Registered: Aug 2009
Location: Chicago
Distribution: CentOS
Posts: 114

Rep: Reputation: 34
What editor are you opening the file in? I'm seeing now that it looks screwed up when I open it in VI, but cat displays the info just fine.
 
Old 04-14-2011, 04:48 PM   #5
humla
LQ Newbie
 
Registered: Apr 2011
Distribution: Ubuntu 10.10
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jcalzare View Post
What editor are you opening the file in? I'm seeing now that it looks screwed up when I open it in VI, but cat displays the info just fine.
opened it in both vim and gedit. its screwed up in both. So its fine on cat huh!, interesting. Wonder why?

EDIT: tried cat, well it shows the proper stuff for a second and then it closes. So is there a way i can convert the data so the others can read it.

Last edited by humla; 04-14-2011 at 06:07 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] HTOP and PID's helptonewbie Linux - Newbie 7 12-30-2010 02:42 AM
using grep to output non-matches into output file binny959 Linux - General 5 12-25-2010 12:20 AM
htop execute and exit... chamila1986 Linux - Newbie 2 01-16-2010 04:21 PM
Output Redirection - Trying to output to screen and file? helptonewbie Linux - Newbie 7 03-19-2009 08:05 AM
the sound gives output when using mic but no output when run a music file medo Debian 0 04-19-2004 08:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:32 AM.

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
Open Source Consulting | Domain Registration