Skip to main content

ls flags: Seeing More

Plain ls shows you the names of files and directories. Flags unlock more detail.

The -l flag: long format

ls -l

Output:

drwxr-xr-x 1 user user 4096 Jan 1 00:00 documents
drwxr-xr-x 1 user user 4096 Jan 1 00:00 downloads

Each column from left to right:

ColumnMeaning
drwxr-xr-xPermissions
1Hard link count
userOwner
userGroup
4096Size in bytes
Jan 1 00:00Last modified time
documentsName

The -a flag: all files including hidden

Hidden files start with a .. They are invisible to plain ls but show up with -a:

ls -a

Output:

. .. .bashrc .secret_file documents downloads
  • . is the current directory
  • .. is the parent directory
  • .bashrc and .secret_file are hidden files

Combining flags

You can combine flags in a single argument:

ls -la

This gives you the long format AND includes hidden files. It's one of the most common ls invocations you'll see in the wild.

Practice

Use ls -a or ls -la to find the hidden file in your home directory.

Loading terminal…
Donate to this project