How to make `ls` color its output by default, without setting up an alias?
up vote
35
down vote
favorite
I don't want an alias (alias ls='ls --color'
), and I had previously set this up on Mac OSX using CLICOLOR
environment variable which magically brought colors to ls
. Now I am on Linux (Arch x86-64) with xterm
and a really basic setup, and I can't make ls
output color (using ls
verbatim). I do get color when using --color
switch.
Is there no way to achieve this? POSIX compliance would be nice :-)
linux ls xterm
add a comment |
up vote
35
down vote
favorite
I don't want an alias (alias ls='ls --color'
), and I had previously set this up on Mac OSX using CLICOLOR
environment variable which magically brought colors to ls
. Now I am on Linux (Arch x86-64) with xterm
and a really basic setup, and I can't make ls
output color (using ls
verbatim). I do get color when using --color
switch.
Is there no way to achieve this? POSIX compliance would be nice :-)
linux ls xterm
add a comment |
up vote
35
down vote
favorite
up vote
35
down vote
favorite
I don't want an alias (alias ls='ls --color'
), and I had previously set this up on Mac OSX using CLICOLOR
environment variable which magically brought colors to ls
. Now I am on Linux (Arch x86-64) with xterm
and a really basic setup, and I can't make ls
output color (using ls
verbatim). I do get color when using --color
switch.
Is there no way to achieve this? POSIX compliance would be nice :-)
linux ls xterm
I don't want an alias (alias ls='ls --color'
), and I had previously set this up on Mac OSX using CLICOLOR
environment variable which magically brought colors to ls
. Now I am on Linux (Arch x86-64) with xterm
and a really basic setup, and I can't make ls
output color (using ls
verbatim). I do get color when using --color
switch.
Is there no way to achieve this? POSIX compliance would be nice :-)
linux ls xterm
linux ls xterm
asked Oct 25 '13 at 12:46
amn
64231833
64231833
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
52
down vote
accepted
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'
2
No reason I cannot - I was on Mac OSX the other day, and it supported theCLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
– amn
Oct 28 '13 at 10:25
11
On Mac OSX you can usealias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
1
also addalias grep='grep --color'
to it ;)
– TechJS
Jul 7 at 4:46
add a comment |
up vote
-2
down vote
if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors
1
This is incorrect.
– Scott
Nov 24 at 23:49
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
52
down vote
accepted
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'
2
No reason I cannot - I was on Mac OSX the other day, and it supported theCLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
– amn
Oct 28 '13 at 10:25
11
On Mac OSX you can usealias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
1
also addalias grep='grep --color'
to it ;)
– TechJS
Jul 7 at 4:46
add a comment |
up vote
52
down vote
accepted
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'
2
No reason I cannot - I was on Mac OSX the other day, and it supported theCLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
– amn
Oct 28 '13 at 10:25
11
On Mac OSX you can usealias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
1
also addalias grep='grep --color'
to it ;)
– TechJS
Jul 7 at 4:46
add a comment |
up vote
52
down vote
accepted
up vote
52
down vote
accepted
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'
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'
answered Oct 25 '13 at 13:03
pdah
70664
70664
2
No reason I cannot - I was on Mac OSX the other day, and it supported theCLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
– amn
Oct 28 '13 at 10:25
11
On Mac OSX you can usealias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
1
also addalias grep='grep --color'
to it ;)
– TechJS
Jul 7 at 4:46
add a comment |
2
No reason I cannot - I was on Mac OSX the other day, and it supported theCLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)
– amn
Oct 28 '13 at 10:25
11
On Mac OSX you can usealias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
1
also addalias grep='grep --color'
to it ;)
– TechJS
Jul 7 at 4:46
2
2
No reason I cannot - I was on Mac OSX the other day, and it supported the
CLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)– amn
Oct 28 '13 at 10:25
No reason I cannot - I was on Mac OSX the other day, and it supported the
CLICOLOR
which I thought was kind of standard (you always tend to think that these things are standard). And I also always thought of aliases as more of an retrofit solution. But they'll do just fine :-)– amn
Oct 28 '13 at 10:25
11
11
On Mac OSX you can use
alias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
On Mac OSX you can use
alias ls='ls -G'
– Gal Bracha
Aug 6 '17 at 13:44
1
1
also add
alias grep='grep --color'
to it ;)– TechJS
Jul 7 at 4:46
also add
alias grep='grep --color'
to it ;)– TechJS
Jul 7 at 4:46
add a comment |
up vote
-2
down vote
if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors
1
This is incorrect.
– Scott
Nov 24 at 23:49
add a comment |
up vote
-2
down vote
if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors
1
This is incorrect.
– Scott
Nov 24 at 23:49
add a comment |
up vote
-2
down vote
up vote
-2
down vote
if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors
if using the -F option --color is unnecessary, for instance alias ll='ls -alF' shows colors
answered Nov 24 at 23:21
Mark
1
1
1
This is incorrect.
– Scott
Nov 24 at 23:49
add a comment |
1
This is incorrect.
– Scott
Nov 24 at 23:49
1
1
This is incorrect.
– Scott
Nov 24 at 23:49
This is incorrect.
– Scott
Nov 24 at 23:49
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f665274%2fhow-to-make-ls-color-its-output-by-default-without-setting-up-an-alias%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown