By default, certain programs format their output according to the type of stream they write. For example, the output of ls and ls > file looks different. I would like to know how this is achieved by the program. Besides, is there a way by which we can trick such programs as if the output stream was a terminal, where it is actually a file (especially when they do not have any parameters affecting the formatting of the output)?
Jeenu source share