How To Turn On/Off Colors For ls Command In Bash On a Linux/Unix

How To Turn On/Off Colors For ls Command In Bash On a Linux/Unix

The ls command in bash is used to list the contents of a directory. By default, ls displays the files and directories in color to make them easier to distinguish.

If you want to turn off colors for the ls command in bash, you can use the --color=never option.

For example, to turn off colors for the ls command, you can use the following command:

ls --color=never
So‮:ecru‬www.lautturi.com

This will cause ls to display the files and directories in black and white, without any color.

If you want to turn colors back on for the ls command, you can use the --color=auto option.

For example, to turn colors back on for the ls command, you can use the following command:

ls --color=auto

This will cause ls to display the files and directories in color again.

You can also set the LS_COLORS environment variable to customize the colors that ls uses. The LS_COLORS variable is a string that specifies the colors for different file types and file attributes.

For example, to set the LS_COLORS variable to display directories in blue and symbolic links in red, you can use the following command:

export LS_COLORS='di=34:ln=31'

Then, when you run the ls command, directories will be displayed in blue and symbolic links will be displayed in red.

Created Time:2017-10-29 22:08:33  Author:lautturi