I'm connected to a bash shell on my ubuntu 16.04 server using Putty on Windows.
This is what it looks like in Putty when I do sudo fdisk -l:
But when I try to pipe the output into less, the colors are not shown:
I have tried sudo fdisk -l | less -R and sudo fdisk -l | less -r, but the output never looks the same as the raw output.
How can I get the output from less to look the same?


fdiskto output colors when piped more than gettinglessto retain colored output. – localhost Oct 22 '16 at 06:49fdiskmentioned. The arguments are the same, but someone reading that question could not know thatfdiskhappens to have the same color argument asgit diff. – localhost Oct 22 '16 at 10:08