Ubuntu Bashrc – Differences Between l, ls, and la Commands

aliasbashrcUbuntu

So, through typing several commands I've found that there's not only ls, but l and la too. There doesn't appear to be any man entries on Ubuntu 12.14. They all appear to do similar things with minor differences:

$ ls
app        config     CONTRIBUTING.md  doc       Gemfile       Guardfile  LICENSE  MAINTENANCE.md  Procfile  Rakefile   script  tmp     VERSION
CHANGELOG  config.ru  db               features  Gemfile.lock  lib        log      PROCESS.md      public    README.md  spec    vendor
$ la
app      CHANGELOG  config.ru        db   features  Gemfile       .git        Guardfile  LICENSE  MAINTENANCE.md  Procfile  Rakefile   .rspec  .secret     spec  .travis.yml  VERSION
.bundle  config     CONTRIBUTING.md  doc  .foreman  Gemfile.lock  .gitignore  lib        log      PROCESS.md      public    README.md  script  .simplecov  tmp   vendor
$ l
app/       config/    CONTRIBUTING.md  doc/       Gemfile       Guardfile  LICENSE  MAINTENANCE.md  Procfile  Rakefile   script/  tmp/     VERSION
CHANGELOG  config.ru  db/              features/  Gemfile.lock  lib/       log/     PROCESS.md      public/   README.md  spec/    vendor/

Just as a bit of trivia, are there more of these and what do they do? Is here any place to find this out? Unfortunately, google searching these commands gets ignored because they're so short.

Best Answer

Aliases

ls is a command, l and 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=....

Debugging it further

You can also use the command type to see how a particular command is getting executed. Is it a command, an alias, or a function.

Example

On my system I have the command ls aliased so that it calls ls but also includes a bunch of extra switches, like so:

$ type -a ls
ls is aliased to `ls --color=auto'
ls is /usr/bin/ls
ls is /bin/ls

In the above output you can see that ls is aliases, but then also on my system's $PATH in the directories /usr/bin and /bin.

Related Question