how to disable color in output of 'top' command?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I'm trying to process 'top' output to set CPU performance data. When I just grep the output it is colorized:
enter image description here
or
enter image description here
The numbers are bold, and it adds a lot of unnecessary data to the output:
enter image description here



I tried to strip the color codes answer but it does not work. I want to avoid other much more complex answers in that question for sake of performance.



I've tried to disable colors by switching term mode but no luck:
enter image description here



So how can I disable the color output?



PS: I found how to get data: I can awk only numbers then it works, but still wonder if there is any way to disable color here.







share|improve this question


















  • 6




    Have you looked into top -b?
    – DopeGhoti
    Dec 5 '17 at 22:49










  • Parsing top output is not really a good idea for monitoring.
    – Patrick Mevzek
    Dec 6 '17 at 2:10










  • @PatrickMevzek please provide better alternative.
    – Putnik
    Dec 6 '17 at 21:31










  • @DopeGhoti perfect! Thank you
    – Putnik
    Dec 6 '17 at 21:33










  • It depends on what numbers do you want (it do not know what "performance data" is) and what you do with them. top is only a frontend using values in collected from various files in /proc/ and /sys/. For example see /proc/meminfo, /proc/loadavg or /proc/stat. There are libraries and tools using and parsing that.
    – Patrick Mevzek
    Dec 6 '17 at 21:34















up vote
1
down vote

favorite












I'm trying to process 'top' output to set CPU performance data. When I just grep the output it is colorized:
enter image description here
or
enter image description here
The numbers are bold, and it adds a lot of unnecessary data to the output:
enter image description here



I tried to strip the color codes answer but it does not work. I want to avoid other much more complex answers in that question for sake of performance.



I've tried to disable colors by switching term mode but no luck:
enter image description here



So how can I disable the color output?



PS: I found how to get data: I can awk only numbers then it works, but still wonder if there is any way to disable color here.







share|improve this question


















  • 6




    Have you looked into top -b?
    – DopeGhoti
    Dec 5 '17 at 22:49










  • Parsing top output is not really a good idea for monitoring.
    – Patrick Mevzek
    Dec 6 '17 at 2:10










  • @PatrickMevzek please provide better alternative.
    – Putnik
    Dec 6 '17 at 21:31










  • @DopeGhoti perfect! Thank you
    – Putnik
    Dec 6 '17 at 21:33










  • It depends on what numbers do you want (it do not know what "performance data" is) and what you do with them. top is only a frontend using values in collected from various files in /proc/ and /sys/. For example see /proc/meminfo, /proc/loadavg or /proc/stat. There are libraries and tools using and parsing that.
    – Patrick Mevzek
    Dec 6 '17 at 21:34













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm trying to process 'top' output to set CPU performance data. When I just grep the output it is colorized:
enter image description here
or
enter image description here
The numbers are bold, and it adds a lot of unnecessary data to the output:
enter image description here



I tried to strip the color codes answer but it does not work. I want to avoid other much more complex answers in that question for sake of performance.



I've tried to disable colors by switching term mode but no luck:
enter image description here



So how can I disable the color output?



PS: I found how to get data: I can awk only numbers then it works, but still wonder if there is any way to disable color here.







share|improve this question














I'm trying to process 'top' output to set CPU performance data. When I just grep the output it is colorized:
enter image description here
or
enter image description here
The numbers are bold, and it adds a lot of unnecessary data to the output:
enter image description here



I tried to strip the color codes answer but it does not work. I want to avoid other much more complex answers in that question for sake of performance.



I've tried to disable colors by switching term mode but no luck:
enter image description here



So how can I disable the color output?



PS: I found how to get data: I can awk only numbers then it works, but still wonder if there is any way to disable color here.









share|improve this question













share|improve this question




share|improve this question








edited Dec 5 '17 at 23:01









Jeff Schaller

32k848109




32k848109










asked Dec 5 '17 at 22:44









Putnik

4142514




4142514







  • 6




    Have you looked into top -b?
    – DopeGhoti
    Dec 5 '17 at 22:49










  • Parsing top output is not really a good idea for monitoring.
    – Patrick Mevzek
    Dec 6 '17 at 2:10










  • @PatrickMevzek please provide better alternative.
    – Putnik
    Dec 6 '17 at 21:31










  • @DopeGhoti perfect! Thank you
    – Putnik
    Dec 6 '17 at 21:33










  • It depends on what numbers do you want (it do not know what "performance data" is) and what you do with them. top is only a frontend using values in collected from various files in /proc/ and /sys/. For example see /proc/meminfo, /proc/loadavg or /proc/stat. There are libraries and tools using and parsing that.
    – Patrick Mevzek
    Dec 6 '17 at 21:34













  • 6




    Have you looked into top -b?
    – DopeGhoti
    Dec 5 '17 at 22:49










  • Parsing top output is not really a good idea for monitoring.
    – Patrick Mevzek
    Dec 6 '17 at 2:10










  • @PatrickMevzek please provide better alternative.
    – Putnik
    Dec 6 '17 at 21:31










  • @DopeGhoti perfect! Thank you
    – Putnik
    Dec 6 '17 at 21:33










  • It depends on what numbers do you want (it do not know what "performance data" is) and what you do with them. top is only a frontend using values in collected from various files in /proc/ and /sys/. For example see /proc/meminfo, /proc/loadavg or /proc/stat. There are libraries and tools using and parsing that.
    – Patrick Mevzek
    Dec 6 '17 at 21:34








6




6




Have you looked into top -b?
– DopeGhoti
Dec 5 '17 at 22:49




Have you looked into top -b?
– DopeGhoti
Dec 5 '17 at 22:49












Parsing top output is not really a good idea for monitoring.
– Patrick Mevzek
Dec 6 '17 at 2:10




Parsing top output is not really a good idea for monitoring.
– Patrick Mevzek
Dec 6 '17 at 2:10












@PatrickMevzek please provide better alternative.
– Putnik
Dec 6 '17 at 21:31




@PatrickMevzek please provide better alternative.
– Putnik
Dec 6 '17 at 21:31












@DopeGhoti perfect! Thank you
– Putnik
Dec 6 '17 at 21:33




@DopeGhoti perfect! Thank you
– Putnik
Dec 6 '17 at 21:33












It depends on what numbers do you want (it do not know what "performance data" is) and what you do with them. top is only a frontend using values in collected from various files in /proc/ and /sys/. For example see /proc/meminfo, /proc/loadavg or /proc/stat. There are libraries and tools using and parsing that.
– Patrick Mevzek
Dec 6 '17 at 21:34





It depends on what numbers do you want (it do not know what "performance data" is) and what you do with them. top is only a frontend using values in collected from various files in /proc/ and /sys/. For example see /proc/meminfo, /proc/loadavg or /proc/stat. There are libraries and tools using and parsing that.
– Patrick Mevzek
Dec 6 '17 at 21:34











1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










Here's one way to disable colored output in top:



Step 1: Run top



Step 2: Press the z key to toggle the color mode



Step 3: Press the W key to save the new setting



For reference, look at the top man page, specifically Section 4: Interactive Commands. There you will find the following descriptions of these two interactive commands:



W :Write-the-Configuration-File
This will save all of your options and toggles plus the
current display mode and delay time. By issuing this command
just before quitting top, you will be able restart later in
exactly that same state.

z :Color/Monochrome toggle
Switches the `current' window between your last used color
scheme and the older form of black-on-white or white-on-black.
This command will alter both the summary area and task area
but does not affect the state of the `x', `y' or `b' toggles.


Also see these related posts:



  • Set default color for top


  • Setting the TOPCOLORS environment variable






share|improve this answer






















  • 'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
    – Putnik
    Dec 6 '17 at 21:41










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409053%2fhow-to-disable-color-in-output-of-top-command%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










Here's one way to disable colored output in top:



Step 1: Run top



Step 2: Press the z key to toggle the color mode



Step 3: Press the W key to save the new setting



For reference, look at the top man page, specifically Section 4: Interactive Commands. There you will find the following descriptions of these two interactive commands:



W :Write-the-Configuration-File
This will save all of your options and toggles plus the
current display mode and delay time. By issuing this command
just before quitting top, you will be able restart later in
exactly that same state.

z :Color/Monochrome toggle
Switches the `current' window between your last used color
scheme and the older form of black-on-white or white-on-black.
This command will alter both the summary area and task area
but does not affect the state of the `x', `y' or `b' toggles.


Also see these related posts:



  • Set default color for top


  • Setting the TOPCOLORS environment variable






share|improve this answer






















  • 'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
    – Putnik
    Dec 6 '17 at 21:41














up vote
2
down vote



accepted










Here's one way to disable colored output in top:



Step 1: Run top



Step 2: Press the z key to toggle the color mode



Step 3: Press the W key to save the new setting



For reference, look at the top man page, specifically Section 4: Interactive Commands. There you will find the following descriptions of these two interactive commands:



W :Write-the-Configuration-File
This will save all of your options and toggles plus the
current display mode and delay time. By issuing this command
just before quitting top, you will be able restart later in
exactly that same state.

z :Color/Monochrome toggle
Switches the `current' window between your last used color
scheme and the older form of black-on-white or white-on-black.
This command will alter both the summary area and task area
but does not affect the state of the `x', `y' or `b' toggles.


Also see these related posts:



  • Set default color for top


  • Setting the TOPCOLORS environment variable






share|improve this answer






















  • 'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
    – Putnik
    Dec 6 '17 at 21:41












up vote
2
down vote



accepted







up vote
2
down vote



accepted






Here's one way to disable colored output in top:



Step 1: Run top



Step 2: Press the z key to toggle the color mode



Step 3: Press the W key to save the new setting



For reference, look at the top man page, specifically Section 4: Interactive Commands. There you will find the following descriptions of these two interactive commands:



W :Write-the-Configuration-File
This will save all of your options and toggles plus the
current display mode and delay time. By issuing this command
just before quitting top, you will be able restart later in
exactly that same state.

z :Color/Monochrome toggle
Switches the `current' window between your last used color
scheme and the older form of black-on-white or white-on-black.
This command will alter both the summary area and task area
but does not affect the state of the `x', `y' or `b' toggles.


Also see these related posts:



  • Set default color for top


  • Setting the TOPCOLORS environment variable






share|improve this answer














Here's one way to disable colored output in top:



Step 1: Run top



Step 2: Press the z key to toggle the color mode



Step 3: Press the W key to save the new setting



For reference, look at the top man page, specifically Section 4: Interactive Commands. There you will find the following descriptions of these two interactive commands:



W :Write-the-Configuration-File
This will save all of your options and toggles plus the
current display mode and delay time. By issuing this command
just before quitting top, you will be able restart later in
exactly that same state.

z :Color/Monochrome toggle
Switches the `current' window between your last used color
scheme and the older form of black-on-white or white-on-black.
This command will alter both the summary area and task area
but does not affect the state of the `x', `y' or `b' toggles.


Also see these related posts:



  • Set default color for top


  • Setting the TOPCOLORS environment variable







share|improve this answer














share|improve this answer



share|improve this answer








edited Dec 6 '17 at 0:06

























answered Dec 5 '17 at 23:51









igal

4,830930




4,830930











  • 'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
    – Putnik
    Dec 6 '17 at 21:41
















  • 'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
    – Putnik
    Dec 6 '17 at 21:41















'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
– Putnik
Dec 6 '17 at 21:41




'Setting the TOPCOLORS' is the exact answer because 'z' turns it even more colorful. Thanks!
– Putnik
Dec 6 '17 at 21:41

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409053%2fhow-to-disable-color-in-output-of-top-command%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?