Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

5 Answers 5

up vote 37 down vote accepted

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 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
share|improve this answer
3  
Now that's a cool trick. I'll have to remember that one. –  Jonathan M Davis Nov 26 '10 at 6:15
3  
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 4:37
$ 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.

share|improve this answer
3  
specifically the * after a file name means that the file is executable –  phunehehe Nov 26 '10 at 2:27

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.

share|improve this answer
    
ls -d that seems like the most useless alias ever. all that prints is . –  xenoterracide Nov 28 '10 at 0:48
1  
-1: in Ubuntu 10.10 it's disabled (commented) by default, and it aliases to ls -CF. –  badp Nov 28 '10 at 15:10
    
but it was there in previous versions. and yes, it was ls -CF, i just didn't have access to an older ubuntu machine to test it out. –  bronzebeard Nov 29 '10 at 5:31

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

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.