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:
| Column | Meaning |
|---|---|
drwxr-xr-x | Permissions |
1 | Hard link count |
user | Owner |
user | Group |
4096 | Size in bytes |
Jan 1 00:00 | Last modified time |
documents | Name |
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.bashrcand.secret_fileare 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.