Where is the alias for "ll" defined?

Solution 1:

In Ubuntu, this alias is defined by default in the ~/.bashrc file, in mine like this:

$ grep "alias ll" ~/.bashrc
alias ll='ls -alF'

Another file read by default is the ~/.bash_aliases. It may not exist until you create it, but it's the recommended way of storing aliases as keeping them in a separate file provides clarity. Your ~/.bashrc contains the following section, the if expression in which loads this aliases file if it exists:

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

As for zsh I suppose the alias is defined in the same manner in your ~/.zshrc file or any file sourced by it. If you use oh-my-zsh it may be contained in lib/directories.zsh or plugins/common-aliases/common-aliases.plugin.zsh.

sh (= dash in Ubuntu) reads only ~/.profile, which normally doesn't contain any aliases as they are defined shell-specific. In the case of an alias as simple as alias ll='ls -lh' however you could go for a definition in ~/.profile. Further reading: Is there a “.bashrc” equivalent file read by all shells?

Solution 2:

For zsh, aliases can be added in .zshrc. ll must have been defined in that file.

You can add an alias in .zshrc by editing it with any file editor such as nano. For example:

alias ll="ls -lh"