Can someone tell me what terminal command the alias
ll is for? All I can find online is many people saying that it is an alias for
ls -l or
ls -la or
ls -ltr. But that's simply wrong. The result looks different. Is there any way to locate
ll and look at its syntax?
You can use the
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'
ll actually means:
ls --color=auto -alF
ll is an alias defined in your
~/.bashrc, provided you didn't change it it's
$ 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
$ grep ls= <~/.bashrc alias ls='ls --color=auto'
ls itself is again an alias for
lsemits color codes only when standard output is connected to a terminal. The
LS_COLORSenvironment variable can change the settings. Use the
dircolorscommand 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.
It should be