Color Linux command output

后端 未结 10 1366
天命终不由人
天命终不由人 2020-12-09 19:03

For example, I\'d like to color the output of the locate command so it\'s easily distinguished from the other terminal text.

It should work something li

10条回答
  •  一向
    一向 (楼主)
    2020-12-09 19:35

    The following answered my question:

    1- I create an alias in my .bashrc

    alias color='grep --color .'
    

    2- Then whenever I want to color the pipeline text output I use color alias like:

    locate -bir pdf | color
    

    This will color the output to red

提交回复
热议问题