70

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.

phunehehe
  • 20,030
  • 27
  • 99
  • 151
Rupert Madden-Abbott
  • 1,044
  • 1
  • 9
  • 10
  • 1
    I came here after seeing the tweet, Unix commands turned into companies , https://twitter.com/valaafshar/status/540694808382431232 and 'l' doesn't work on my mac! lol – AnneTheAgile Jan 10 '15 at 23:55
  • @don_crissti the other one is broader, since it names about one more alias, and asks about more. – muru Feb 17 '16 at 18:14
  • @muru The other answer does not explain what the `*` in front of each file is. –  Feb 17 '16 at 18:46
  • @BinaryZebra Considering the accepted answer here doesn't explain it either, I'm inclined to think it's a minor point. :shrug: – muru Feb 17 '16 at 18:48
  • Use `type l` to find what is `l` (if anything), the try `alias l` to see what is the alias of `l`. –  Feb 17 '16 at 18:49
  • `l` was created so that you get (almost) the same output as `ls` when you are typing so fast and miss the last `s` :P – Vthechamp Jan 07 '21 at 14:08

5 Answers5

110

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

LONG ANSWER 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.

Examples:

$ 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
Shawn J. Goff
  • 45,338
  • 25
  • 134
  • 145
  • 15
    Now *that's* a cool trick. I'll have to remember that one. – Jonathan M Davis Nov 26 '10 at 06:15
  • 4
    This command (A bash builtin) is very useful. I'm amazed that I've never seen it mentioned everywhere. – Stefan Lasiewski Nov 28 '10 at 04:37
  • Excellent examples, I think you covered it thoroughly. Since I've seen people use `type` to check if a command is installed, I'll just mention here that it's possible for the hashed commands to be out of date, in which case `type ` will return success for some time after `` has actually been deleted. – Wildcard Jan 06 '16 at 05:40
9
$ 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.

johnsyweb
  • 839
  • 7
  • 10
4

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.

Rohan Monga
  • 914
  • 7
  • 5
2

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

oadams
  • 2,305
  • 5
  • 21
  • 20
2

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`"
    else
        eval "`dircolors -b /etc/DIR_COLORS`"
    fi
    alias ls='ls --color=auto'
    #alias dir='ls --color=auto --format=vertical'
    #alias vdir='ls --color=auto --format=long'
fi

# 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
polemon
  • 11,133
  • 11
  • 69
  • 111