ls -a

$ ls -a
.  ..  .preferences  action  drama comedy  genres.txt
  1. The ls command lists all files and directories in the working directory.
  2. The -a modifies the behavior of the ls command to also list the files and directories starting with a dot (.). Files started with a dot are hidden, and don't appear when using ls alone.

The -a is called an option. Options modify the behavior of commands. Here we used ls -a to display the contents of the working directory in more detail.

In addition to -a, the ls command has several more options. Here are three common options:

  • -a - lists all contents, including hidden files and directories
  • -l - lists all contents of a directory in long format
  • -t - order files and directories by the time they were last modified.

Let's practice using these options below.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.