How to change the directory colors for the command LS

bash is a Unix shell written for the GNU Project. Its name is an acronym for Bourne-again shell, a pun ('Bourne again' / 'born again') on the name of the Bourne shell (sh), an important early Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978. bash was created in 1987 by Brian Fox. In 1990, Chet Ramey became the primary maintainer.

bash is the default shell on Debian. Its output can be colorized to increase human readability.

Add the following contents to the system-wide configuration file /etc/bash.bashrc or the user's ~/.bashrc, using your preferred text editor:

nano ~/.bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
 export LS_OPTIONS='--color=auto'
 eval "`dircolors`"
 alias ls='ls $LS_OPTIONS'
 alias ll='ls $LS_OPTIONS -l'
 alias l='ls $LS_OPTIONS -lA'

# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

Apply changes by executing the command

~$ source /etc/bash.bashrc; source ~/.bashrc

Or by executing

~$ exec bash

Now test to make sure that changes were applied

ls

The output of commands should appear in color.

  • change colors, ls
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a Mac for Your Kids

Providing children with access to a computer and the internet is increasingly important, but so...

How to Get Help With a Command from the Linux Terminal

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the...

How to change the ssh port on Linux

To Change the SSH Port for Linux Server Connect to your server via SSH Switch to the root...

How To Install screenFetch in Linux

If you've browsed Linux groups on social media, you've probably seen a lot of screenshots that...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Powered by WHMCompleteSolution