Commands.page Logo

Which Option Allows ls to Display Color-Coded File Types

This article explains how to enable colorized output when listing directory contents in Ubuntu. It identifies the specific command-line flag required to differentiate file types visually and provides instructions on verifying or configuring this setting within your terminal environment.

The option that allows the ls command to display color-coded file types is --color. When used, this flag tells the system to apply specific colors to directories, executables, symlinks, and other file types based on their permissions and extensions.

In most standard Ubuntu installations, this feature is enabled by default through an alias. You can check if it is active by running the following command:

alias ls

If the output shows ls='ls --color=auto', color coding is already active. To use the option manually without an alias, type:

ls --color

If colors are not appearing, you can enable them permanently by editing your .bashrc file. Add the following line to the end of the file:

alias ls='ls --color=auto'

After saving the file, run source ~/.bashrc to apply the changes immediately. This ensures that every time you list files, distinct colors help you identify directories and executable scripts quickly.