la accidentally instead of
ls to view the contents of a directory and it produces exactly the same output as
Why is this? Surely it doesn't make sense to have two commands that do the exact same thing.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
la is an alias to
ls -A defined in
~/.bashrc file in Ubuntu.
It only shows the same output if you have no hidden files or directories.
ls -A shows hidden files and directories.
la is defined as an alias in Ubuntus
~/.bashrc file together with a few others.
la is simply an
ls -A as you can see in the following snippet from the
# this alias is defined earlier to grant colored output alias ls='ls --color=auto' # some more ls aliases alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' alias li='ls -lF'
When in doubt,
la is aliased to `ls -la'
la is a function with definition function la --description 'List contents of directory, including hidden files in directory using long format' ls -lah $argv end
ls is a command,
la are most likely aliases which make use of the command
ls. If you run the command
alias you can find all the aliases on your system.
$ alias | grep -E ' l=| la='
This will return all the aliases that match the pattern l=... or la=....
They do not produce the same output in all directories.
Create a dotfile with
touch .whatever, then issue both
la is an alias for
ls -A, as stated by other answers. As such, it can't be used in shell scripts, while
Your computer has multiple aliased commands. A complete list can be obtained by executing
alias. On my machine it prints this:
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto'
--color=auto means colour will be turned off when not printing directly to STDOUT.