Linux · Stage 1 – Finding Your Way Around · Lesson 10 of 51

Useful ls Options

Add the common -l and -a options to ls, learning one option at a time.

First, ask ls for a long listing:

Command

ls -l
Piece-by-piece explanation
  1. ls is the list command.
  2. The space separates the command from its option.
  3. -l means long format.
  4. The long format adds permissions, owner, size, date, and name.
Expected output
drwxr-xr-x 2 maya maya 4096 Jul 15 10:00 Documents
-rw-r--r-- 1 maya maya  120 Jul 15 10:02 notes.txt

Your details differ. A line beginning with d represents a directory; a dash normally represents a regular file.

Now learn a separate option that includes hidden names:

Command

ls -a
Piece-by-piece explanation
  1. ls still lists names.
  2. -a means all.
  3. It includes names beginning with a dot.
  4. The special entries . and .. also appear.
Expected output
.  ..  .bashrc  Desktop  Documents

Your hidden names differ. The single dot means the current directory; two dots mean its parent.

Options can later be combined as -la, but practice each one separately first so its effect is clear.