How to make `ls` color its output by default, without setting up an alias?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2
--
Chapters
00:00 How To Make `Ls` Color Its Output By Default, Without Setting Up An Alias?
00:36 Accepted Answer Score 107
01:03 Answer 2 Score 0
01:20 Thank you
--
Full question
https://superuser.com/questions/665274/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #ls #xterm
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 2
--
Chapters
00:00 How To Make `Ls` Color Its Output By Default, Without Setting Up An Alias?
00:36 Accepted Answer Score 107
01:03 Answer 2 Score 0
01:20 Thank you
--
Full question
https://superuser.com/questions/665274/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #ls #xterm
#avk47
ACCEPTED ANSWER
Score 107
There is no way: the ls man page will show you that the default setting (for --color) is 'none' - ie. never use colour.
Any reason you don't want to use aliases? I'm a recovering Red Hat user, so every time I install a new distribution I set three ls aliases like so:
## Colorize the ls output ##
alias ls='ls --color=auto'
## Use a long listing format ##
alias ll='ls -la'
## Show hidden files ##
alias l.='ls -d .* --color=auto'
ANSWER 2
Score 0
You can use the alias method so that every time you open the terminal and use ls
(verbatim just ls
, not ls --color
), results will be coloured. You can add the alias to your .bashrc
, for example, as the following command line:
alias ls='ls --color=auto'