What command is the alias ll for?
You can use the alias
or type
commands to check what a specific alias means:
$ alias ll
alias ll='ls -alF'
$ type ll
ll is aliased to `ls -alF'
Note however that aliases might use other aliases, so you might have to check it recursively, e.g. in the case of ll
, you should also check the ls
command it calls:
$ alias ls
alias ls='ls --color=auto'
$ type ls
ls is aliased to `ls --color=auto'
So ll
actually means:
ls --color=auto -alF
ll
is an alias defined in your ~/.bashrc
, provided you didn't change it it's ls -alF
:
$ grep ll= <~/.bashrc
alias ll='ls -alF'
These three options are:
- -a, --all – do not ignore entries starting with .
- -l – use a long listing format
- -F, --classify – append indicator (one of */=>@|) to entries
As
$ grep ls= <~/.bashrc
alias ls='ls --color=auto'
shows, ls
itself is again an alias for ls --color=auto
:
With
--color=auto
,ls
emits color codes only when standard output is connected to a terminal. TheLS_COLORS
environment variable can change the settings. Use thedircolors
command to set it.
You can look in your ~/.bashrc (or some file where your aliases are) or you can write some of these commands in your shell:
command -v ll # "command" is a shell built-in that display information about
# the command. Use the built-in "help command" to see the
# options.
type -p ll # "type" is another built-in that display information about how the
# command would be interpreted
grep -r "alias ll=" ~ # and don't worry about de .file that contains your
# alias. This command search recursively under each
# folder of your home. So it's something rude.
find ~ -maxdepth 1 -type f | xargs grep "alias ll" # Just look in
# the files (not folders) in your home folder
But why use find without the -name ".*" ? Cause you can put this in your .bashrc
source bash_hacks # where the file bash_hacks, in your home directory can
# contain the alias ll='ls -la etc etc'.
Since "ll" it's an alias, it's not necesary that have just one meaning (ll='ls -alF --color'), you can alias your "ll" like another comand like, i don't know, "rm". I think it's more a convention (product of common uses).
But "ll" could be a program stored in any folder of your PATH. For example, if you have a folder named "bin" in your home, make a "ll" script that contains something like
#!/bin/bash
ls -lhar
But, what if your PATH have been altered to add another folder that contains the new "ll" command? For more interesting information, you can consult the following link to a related question.
- https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then