default ls command

yyg

New Member
Joined
Oct 28, 2025
Messages
12
Reaction score
8
Credits
107
Could use some help,
I was attempting to alias the 'ls' command to alias ls='ls -l' and instead broke it.

ls command not found

re-aliased as:
alias ls='ls -lA | more'

but now colours are broken for files are directives and everything is white, but at least ls is working now. Can someone list the default value for the command please?

Mint 22.2 - cinnamon 64bit.iso

:p
 


where did you edit it, good sir? at ~/.bashrc?
 
command working again but still not colorized
I don't think "more" will show anything colorized since it's made to show the content of a file not file types. but don't trust me, i'm just a newbie.
In my view it's a over statement to an already solved output.
 
Could use some help,
I was attempting to alias the 'ls' command to alias ls='ls -l' and instead broke it.

ls command not found

re-aliased as:
alias ls='ls -lA | more'

but now colours are broken for files are directives and everything is white, but at least ls is working now. Can someone list the default value for the command please?

Mint 22.2 - cinnamon 64bit.iso

:p
It may be considered unwise to alias the ls command to ls -l for several reasons.
One is that the simple ls which just produces the names of the files in a listing, is often useful compared to always having the long listing that ls -l provides.

If one aliases the ls to ls -l, then to get a "pure" ls output of the listing one needs to escape the command thus: \ls, which will give a default listing.

If one wants color, then ls can be aliased to color without any other aspect. That's commonly found in the user's .bashrc with the alias: alias ls='ls --color=auto'. Once that alias is set, all ls outputs, aliased or not, will have color except for \ls which outputs the initial default.

For a long listing with ls, the alias often used is: alias ll='ls -l' which means that the keyboard presses for a long listing become quite economical just using ll.
 
edit your .bashrc

alias ls='ls --color=auto'
alias la='ls -a --color=auto'
alias ll='ls -l --color=auto'
alias lla='ls -la --color=auto'
 
Thank you all for your input!

I see a majority of these commands already embeded in my .bashrc file, but there are some chunks of code that are not embded between if / fi or case / esac statements. and many descriptors for some baked in commands nested behind # (which I know to be a note assignment). does the color argument need to be nested with a statement, and does its line placement within the file effect the argument?
 
does the color argument need to be nested with a statement, and does its line placement within the file effect the argument?
I can't parse what you mean by 'nested' but the ls command uses '--color=auto' as optional parameter - you can see that in the examples the others gave and the ls manual.

The placement matters in so far, as a later alias with the same name will replace an earlier one. So, if your distro default nests a .bash_aliases, you should use that for your custom ones. If you erroneously define a same-name alias in .bashrc after the nesting, your later will override and vice versa.
 
That is most likely what I've done by mistake!
I had set aliases for common commands while following a learn linux tv (awesome video series) and placed the aliases pretty early in the .bash file above the defaulted aliases that were commented out by #.
Thank you all for the advice, since opening this thread Ive hopped to Debian 13 and have been enjoying it.
(and my terminal is all pretty again)
 


Follow Linux.org

Staff online

Members online


Top