📅 2017-Aug-23 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ colors, ls ⬩ 📚 Archive
Use of colors for indicating different types of files and directories can be enabled for the ls command. This is useful to discern the files you want from the output quickly.
To enable color output use the --color
option. To be more clever and show colors only when the output is not being piped to another program, use the --color=auto
option.
By default, these colors are used: blue for directories, cyan for symbolic links, green for executables, yellow for device files, red for archived files and pink for image files.
You can see the color settings for the various file types and extensions by running the dircolors
command or echo $LS_COLORS
. Both of them should show the same output.
The explanation of the various foreground and background color values as set in $LS_COLORS
are explained here.
To set your own colors or add new filetypes with colors, change the $LS_COLORS
environment variable in your shell startup file.
Once you have colors, you may find the character indicators that ls uses by default as unnecessary. You can turn them off by using the --indicator-style=file-type
option.