command [options] [argument]
| Part | Description | Example |
|---|---|---|
| Command | The action to run | ls |
| Option | Modifies how the command behaves | -l, -a, --help |
| Argument | The target the command acts on | /home, file1 |
.).| Format | Example | Notes |
|---|---|---|
| Single dash + letter | -l |
Short form — most common |
| Double dash + word | --help |
Long form — easier to read |
| Combined short options | -la |
Same as -l -a together |
ls Command — Optionsls Options| Option | Meaning | Description |
|---|---|---|
ls |
Default | Lists contents of current directory |
ls -l |
Long listing | Shows detailed info for each item |
ls -a |
All | Shows hidden files (files starting with .) |
ls -la or ls -a -l |
Combined | Long listing including hidden files |
ls -R |
Recursive | Lists all directories and their contents |
ls -r |
Reverse | Lists in reverse alphabetical order |
ls -d |
Directory itself | Shows info about a directory, not its contents |
ls --help |
Help | Shows all available options |
ls /path |
With argument | Lists contents of a specific path |
ls -l OutputEach line in ls -l output looks like this:
drwxr-xr-x 2 aliaa aliaa 4096 Dec 14 10:00 Desktop
| Column | Example | Meaning |
|---|---|---|
| 1st character | d or - or l |
File type (see below) |
| Next 9 characters | rwxr-xr-x |
Permissions (3 groups of 3) |
| Number | 2 |
Hard link count |
| 3rd field | aliaa |
Owner (user) |
| 4th field | aliaa |
Group owner |
| Size | 4096 |
File/directory size in bytes |
| Date | Dec 14 10:00 |
Last modification date and time |
| Name | Desktop |
File or directory name |
| Character | File Type |
|---|---|
d |
Directory |
- |
Regular file (text, etc.) |
l |
Symbolic link (soft link / shortcut) |
c |
Character device (e.g., TTY — reads input character by character) |
b |
Block device (e.g., hard disk) |