2

I've accidentally stumbled into the l command in ubuntu which is pretty similar to ls, although the output is slightly different.

For instance, the output of both commands in a directory with the following tree structure is:

Test
|_ Folder1
|_ Folder2
|_ File1
|_ File2

~/Test$ ls
File1  File2  Folder1  Folder2

~/Test$ l
File1  File2  Folder1/  Folder2/

Note the slahes at the end of each folder. What exactly is l and which differences does it have with respect to ls?

wjandrea
  • 14,236
  • 4
  • 48
  • 98

1 Answers1

5

l is an alias for ls -CF

the -F option for ls gives file type; the / means the file is a directory.

the -C option for ls arranges output in columns

For more options to ls see man ls

To see all aliases defined in the system just type alias

Some default aliases relating to ls (notice that ls itself is an alias!)

alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'

As mentioned by Rinzwind, if you find an unfamiliar command and nothing comes up with man <command> you should start by typing type <command> which will tell you what kind of command it is; in this case you get

type l
l is aliased to `ls -CF`

so you can investigate further :)

Rinzwind also pointed out that l will behave differently (or do nothing) in other systems, including older versions of Ubuntu, depending on whether and for what it is defined as an alias.

Zanna
  • 70,465