Difference between ls -l and ll?

  • I'm relatively new to programming as a whole and some tutorials have been telling me to use ls -l to look at files in a directory and others have been saying ll. I know that ls is a short list, but is there a difference between the other two?

    You may want to take a look at `which ll`. You will probably discover that `ll` is actually an alias for `ls -l`.

    So then what is the difference between `ls` any other command I put into the shell? If I type `which ls` I get `alias ls='ls --color=auto' /bin/ls`, but if I type (for example) `which cd` I get `/usr/bin/which: no cd in (........)`. EDIT: I tried it again with `which mkdir` and I got `/bin/mkdir`. What is the distinction between these commands that some of them are stored(?) in `/usr/bin` and some are apparently not?

    this is an affect of your distro's default `$PATH`. `ls` is very often aliased, so your shell reports the alias (which takes precedence over the binary) and the binary's actual location (in your case, `/bin/ls`). If `which` could not find `cd`, then something appears terribly wrong.

    `cd` is a shell builtin keyword, not a program found in a filesystem. Use `type cd` and `type ls` to see what I mean. Some commands are simply overriden by shell builtins: `echo` exists in `/bin/echo`, but in `bash` and in fact most of modern shells, a builtin `echo` function is called instead (which usually has extended features). `type` actually tells you which one it is.

  • cuonglm

    cuonglm Correct answer

    6 years ago

    On many systems, ll is an alias of ls -l:

    $ type ll
    ll is aliased to `ls -l'

    They are the same.

    ll is aliased to `ls -ltr' - I am using red hat 6

    in Ubuntu 14.04 ll is aliased to 'ls -alF'

    Also `ls -alF` in Ubuntu 12.04, 16.04, and likely many more.

    For me on macOS Sierra ll is aliased to `ls -lh`

    zsh: command not found: ll :(

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM