Piping curl http://cheat.sh/python to less is showing strange ESC[38;5;246m
3
votes
1
answer
286
views
I am kinda new to Linux.
My base issue: I need to show the output of
curl cheat.sh/python
like a man
or less
page, so that I can easily scroll up and down.
What have I tried: curl cheat.sh/python | less
outout: some weird text like this-
> ESC38;5;246m# Python is a high-level programming languageESC[39m
> ESC[38;5;246m# and python is a Python interpreter.ESC[39m
>
> ESC[38;5;246m# Basic example of server with pythonESC[39m
> ESC[38;5;246m# Will start a Web Server in the current directory on
> port 8 000ESC[39m ESC[38;5;246m# go to http://127.0.0.1:8000ESC[39m
> ESC[38;5;246m#ESC[39m ESC[38;5;246m# Python v2.7ESC[39m
> ESC[38;5;252mpythonESC[39mESC[38;5;252m
> ESC[39mESC[38;5;252m-mESC[39mESC[ 38;5;252m
> ESC[39mESC[38;5;252mSimpleHTTPServerESC[39m ESC[38;5;246m# Python
> 3ESC[39m ESC[38;5;252mpythonESC[39mESC[38;5;252m
> ESC[39mESC[38;5;252m-mESC[39mESC[ 38;5;252m
> ESC[39mESC[38;5;252mhttp.serverESC[39mESC[38;5;252m ESC[39mESC[
> 38;5;67m8000ESC[39m ...
After having a look at [this , I tried: curl -vs cheat.sh 2>&1 | less
but output was kinda same:
> Accept: */*
> * Mark bundle as not supporting multiuse HTTP/1.1 200 OK Server: nginx/1.13.12 Date: Wed, 25 Mar 2020 17:50:04 GMT Content-Type:
> text/plain; charset=utf-8 Content-Length: 25502 Connection: keep-alive
> Strict-Transport-Security: max-age=63072000; includeSubdomains
> X-Frame-Options: DENY X-Content-Type-Options: nosniff { [2429 bytes data]
> ESC[38;2;0;204;0m_ESC[0mESC[38;2;0;204;0m_ESC[0mESC[38;2;0;204;0m
> ESC[0mESC[38;2;0;204;0m ESC[0mESC[38;2;0; 204;0m ESC[0m
> ___| |__ ___ __ _| |_ ___| |__ ESC[38;2;0;204;0m\ESC[0mESC[38;2;0;204;0m
> ESC[0mESC[38;2;0;204;0m\ESC[0mESC[38;2;0;204;0m ESC[0mESC[38;2;0;
> 204;0m ESC[0m ESC[48;2;85;85;85m ESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85mTESC[0mESC[48;2;85;85;85mhESC[0mESC[48
> ;2;85;85;85meESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85moESC[0mESC[48;2;85;85;85mnESC[0mESC[48;2;85;85;85mlESC[0mESC[48;2;85;85;85myESC[0m
> ESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85mcESC[0mESC[48;2;85;85;85mhESC[0mESC[48;2;85;85;85meESC[0mESC[48;2;85;85;85maESC[0mESC[48;2;85;85;85mt
> ESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85msESC[0mESC[48;2;85;85;85mhESC[0mESC[48;2;85;85;85meESC[0mESC[48;2;85;85;85meESC[0mESC[48;2;85;85
> ;85mtESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85myESC[0mESC[48;2;85;85;85moESC[0mESC[48;2;85;85;85muESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;
> 85;85;85mnESC[0mESC[48;2;85;85;85meESC[0mESC[48;2;85;85;85meESC[0mESC[48;2;85;85;85mdESC[0mESC[48;2;85;85;85m
> ESC[0mESC[48;2;85;85;85m ESC[0mESC[ 48;2;85;85;85m ESC[0m ...
Finally if I change the above code like (this is probably the wrong approach) : curl -vs cheat.sh 1>&2 | less
Then I will get the needed output of curl, but upon pressing a button the terminal shows like:
> ~
> ~
> ~
> ~
> ~
> ~
> ~
> ~
> ~
> ~
> ~ (END)
and I can basically press q to quit out of less
from there.
Asked by Midhunraj R Pillai
(335 rep)
Mar 25, 2020, 06:03 PM
Last activity: Mar 25, 2020, 06:23 PM
Last activity: Mar 25, 2020, 06:23 PM