Allgemein

ls Cheatsheet

ls Cheatsheet

Basic Listing

Use these commands for everyday directory listing.

Command Description
ls List files in current directory
ls /path/to/dir List files in specific directory
ls -1 One entry per line
ls -a Include hidden files
ls -A Include hidden files except . and ..

Long Format and Metadata

Show permissions, ownership, size, and timestamps.

Command Description
ls -l Long listing format
ls -lh Human-readable file sizes
ls -la Long format with hidden files
ls -n Numeric UID and GID
ls -li Show inode numbers

Sorting

Sort files by time, size, extension, or version.

Command Description
ls -lt Sort by modification time (newest first)
ls -ltr Sort by modification time (oldest first)
ls -lS Sort by file size (largest first)
ls -lX Sort by extension
ls -lv Natural sort for version-like names

Time Display

Control which timestamp is shown.

Command Description
ls -lt --time=atime Sort/show by access time
ls -lt --time=ctime Sort/show by status change time
ls -l --time-style=long-iso ISO-like date format
ls -l --full-time Full timestamp precision

Directory Views

List directories recursively or show directory entries only.

Command Description
ls -la --group-directories-first Long listing with directories before files
ls -d */ List only directories in current path
ls -ld /path/to/dir Show metadata for directory itself
ls -R Recursive listing
ls -laR Recursive long listing with hidden files

Output Formatting

Adjust visual style and indicators.

Command Description
ls -F Append indicator (/, *, @) by file type
ls -p Append / to directories
ls -m Comma-separated output
ls -x List entries across rows instead of down columns
ls --color=auto Enable colorized output when supported

Filtering with Globs

List files that match shell patterns.

Command Description
ls *.log List files ending in .log
ls file?.txt Match single-character wildcard
ls [ab]*.conf Match names starting with a or b
ls -d .[^.]* List hidden files (common shell pattern)

Common Patterns

Frequent command combinations.

Command Description
ls -lah Most common detailed listing
ls -lhS Largest files first with readable sizes
ls -lat Newest files first including hidden entries
`ls -1 wc -l`
`ls -l grep ‘^d’`

Troubleshooting

Quick checks for typical listing issues.

Issue Check
Hidden files not visible Add -a or -A
File sizes are hard to read Use -h with -l
Wrong sort order Confirm flags (-t, -S, -X, -r)
No color output Try ls --color=auto and check alias settings
Path looks empty Verify permissions with ls -ld /path

Related Guides

Use these references for deeper file management workflows.

Guide Description
How to List Files in Linux Using the ls Command Full ls guide with practical examples
Du Command in Linux Check disk usage and file sizes
Linux Commands Cheatsheet General command quick reference