What is the difference between ls and l?

I accidentally typed l instead of ls today and found that the command still printed a list of the files in my current directory. Trying l --help brings up the help file for ls suggesting that l is just an alias of ls.

Howver, each file was suffixed by a *. Why is this and what does it mean?

In case it makes a difference, this is when running the latest stable version of Ubuntu.

$ l --help
l: command not found

Looks like you have an alias set up in your environment. Perhaps you have inherited a .profile, .bashrc or similar containing something like alias l='ls -F'.

-F, --classify
              append indicator (one of */=>@|) to entries

Try which l and alias to track down its definition.

Answered By: johnsyweb

SHORT ANSWER: understand what exactly this alias does, you can check out the ~/.bashrc file and search for the term “alias l=“. It is nothing but ls -CF

A good way to inspect what a command is:

type l

If it’s a program or a script, it will give you its location, if it is an alias, it will tell you what it’s aliased to, if it’s a function, it will print the funciton; otherwise, it will tell you if it is a built-in or a keyword.


$ type l
l is aliased to `ls -CF'
$ type find
find is /usr/bin/find
$ type connecthome
connecthome is hashed (/usr/local/bin/connecthome)
$ type grep
grep is aliased to `grep --color=auto --binary-files=without-match --devices=skip'
$ type hello_se
hello_se is a function
hello_se () 
  echo 'Hello, Stack Exchangers!'
$ type type
type is a shell builtin
$ type for
for is a shell keyword
$ type nosuchthing
-bash: type: nosuchthing: not found
Answered By: Shawn J. Goff

FIXED: l is an alias for ls -CF ( I am not really sure ) in the default .bashrc in ubuntu

You can just type alias to check out all the aliases. It would be mentioned there.

Answered By: Rohan Monga

By default, it is an alias for ls -CF in ubuntu.

Answered By: oadams

I redefined all my ls shortcuts in my .zshrc.

This is the relevant section:

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    if [ -n ~/.dir_colors ]; then
        eval "`dircolors -b ~/.dir_colors`"
        eval "`dircolors -b /etc/DIR_COLORS`"
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'

# some more ls aliases
alias l='ls -CF'
alias ll='ls -ClhF'
alias la='ls -CaF'
alias lla='ls -CalhF'
alias l.='ls -CAF --ignore=*'
alias ll.='ls -CAlhF --ignore=*'
alias t='tree -C'

Note that ls is redefined itself:

% type ls
ls is an alias for ls --color=auto
Answered By: polemon
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.