Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash Command Line Colors

Tags:

bash

Bash provides the feature of colors for specific types of files. For example, by default ls will show directories as blue, utilities as green, files as white and etc. I know these colors can be customized for the output of commands such as ls via modifying ~/.dir_colors and other files depending upon how widespread on the system the change should be applied.

However, during screen-casts and presentations I have seen the command line itself have these color modifications. For example at the bash prompt if someone types a utility and starts typing its arguments, the utility on the line is colored green as it would be in the output of ls. This seems like a nice feature, but all google searches seem to turn up is how to modify outputs of ls and customize the colors, but not how to apply this to the command line itself. How can this be applied to the command line? Is it possible via bash or is this a feature of some terminal software these users are using?

like image 586
majic bunnie Avatar asked Nov 26 '14 23:11

majic bunnie


People also ask

How do you change the color of the command line in Linux?

“tput setaf” sets foreground color, “tput setab” sets background color, and “tput sgr0” resets all the settings to terminal default. There are 8 standard colors encoded in numbers from 0 to 7 (in order: black, red, green, yellow, blue, magenta, cyan, white).


1 Answers

fish - the Friendly interactive shell https://en.wikipedia.org/wiki/Friendly_interactive_shell looks like it reacts as you describe.

like image 130
Bill Warner Avatar answered Oct 05 '22 12:10

Bill Warner