The ls command

The ls program prints human-readable listings of directories. By default, with no arguments, this list is just the names of each file in the current directory, printed horizontally for readability:

$ ls
books  documents  music

If we add the -a flag, we can include dot files in our output, files beginning with a period:

$ ls -a
.  ..  .bashrc  .profile  books  documents  music

Note that this output includes the  . and .. entries, referring to the current and parent directory, respectively.

Using the -l option, which can be combined with -a, we can get a long listing of files:

$ ls -al drwxr-xr-x 91 bashuser bashuser 16384 Jul 7 19:50 . drwxr-xr-x 5 root root 4096 Jun 1 20:28 .. -rw-r--r-- 1 bashuser bashuser 3391 Jun 30 01:03 .bashrc ...

Get Bash Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.