l, ls & la — what are the differences, and are there more of these commands?

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.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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.

Method 2

They are just alias of the ls command with some options.
enter image description here

man ls will list out all the options and their purpose. You can make your own alias by executing on the terminal or adding in .bashrc something like:
alias lsl=’ls -lrt’

Method 3

Try la -help on BSD Unix systems to get more information on la. I also found la as a result of a typo.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x