Skip to content
BENIBIX Learn

ls

Infrastructure⌨️ Linux & the Command LineFiles and Folders

Also known as ls Command, List Files, ls -la

A command that lists what is in a folder. It shows files and folders.

Think of it like

Think of it like a peek in a box to see what is in it.

Example

Emma types ls -l in her web folder. She sees index.html, who owns it and when it last changed.

Why it matters

It is the command you will type most. You use it to see what is there before you change anything.

Definition

The ls command lists the files and folders in a folder. With no extra words, it lists the folder you are in. Adding -l shows more about each file, like its size, owner and rights. Adding -a also shows hidden files. You can give it a path to look in another folder.

Example code

console
$ ls
notes.txt  photos
$ ls -a
.  ..  .bashrc  .ssh  notes.txt  photos
Plain ls hides files that start with a dot. Adding -a shows them too.
Inside Emma's home, ls lists notes.txt and photos. The dot folders stay hidden until you add -a.

Common mistake

Thinking a file is missing because ls does not show it. It may be hidden, so try ls -a.

Key takeaways

  1. 1
    What is here. Lists the current folder.
  2. 2
    -l for detail. Size, owner and rights.
  3. 3
    -a for hidden. Shows dot files too.

Learn it properly