CtrlK
BlogDocsLog inGet started
Tessl Logo

ls

List directory contents. Use when you need to view files in a directory, check permissions, sizes, timestamps, or sort/filter file listings.

72

1.08x
Quality

64%

Does it follow best practices?

Impact

74%

1.08x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

Optimize this skill with Tessl

npx tessl skill review --optimize ./.flox/pkgs/skill-coreutils/skills/ls/SKILL.md
SKILL.md
Quality
Evals
Security

ls - List Directory Contents

Synopsis

ls [OPTION]... [FILE]...

List information about FILEs (current directory by default). Sorts entries alphabetically unless a sort option is specified.

Flags

Display Control

FlagLong FormDescription
-a--allShow all entries including those starting with .
-A--almost-allShow all except . and ..
-B--ignore-backupsIgnore entries ending with ~
-d--directoryList directories themselves, not contents
-I--ignore=PATTERNDon't list entries matching PATTERN
--hide=PATTERNDon't list entries matching PATTERN (overridden by -a/-A)

Format

FlagLong FormDescription
-lLong listing format (permissions, owner, size, date)
-1One entry per line
-CList entries by columns (default for terminal)
-mComma-separated list
-xList entries by lines instead of columns
--format=WORDacross/horizontal (-x), commas (-m), long (-l), single-column (-1), verbose (-l), vertical (-C)
-gLike -l but don't show owner
-oLike -l but don't show group
-G--no-groupIn long listing, don't print group names
-n--numeric-uid-gidLike -l but show numeric UID/GID

Size Display

FlagLong FormDescription
-h--human-readablePrint sizes in human-readable format (1K, 234M, 2G)
--siLike -h but use powers of 1000 not 1024
-s--sizePrint allocated size in blocks
-k--kibibytesDefault to 1024-byte blocks (with -s)
--block-size=SIZEScale sizes by SIZE (e.g., --block-size=M)

Sorting

FlagLong FormDescription
-tSort by modification time, newest first
-SSort by file size, largest first
-vNatural sort of version numbers
-XSort alphabetically by extension
-UDo not sort; list in directory order
-r--reverseReverse sort order
-fDo not sort, enable -aU, disable -ls --color
--sort=WORDSort by WORD: none (-U), size (-S), time (-t), version (-v), extension (-X)
--group-directories-firstGroup directories before files

Time Display

FlagLong FormDescription
-cWith -lt: sort by ctime; with -l: show ctime
-uWith -lt: sort by access time; with -l: show atime
--time=WORDSelect time: access/atime/use (-u), ctime/status (-c), birth/creation
--time-style=STYLETime display: full-iso, long-iso, iso, locale, +FORMAT
--full-timeLike -l --time-style=full-iso

Indicators and Links

FlagLong FormDescription
-F--classifyAppend indicator (*/=>@|) to entries
-pAppend / to directories
--file-typeLike -F but don't append *
-L--dereferenceShow info for link target, not the link
-H--dereference-command-lineFollow symlinks on command line
-i--inodePrint inode number of each file
--hyperlink[=WHEN]Hyperlink file names (always, auto, never)

Escaping and Color

FlagLong FormDescription
-b--escapePrint C-style escapes for nongraphic chars
-q--hide-control-charsPrint ? instead of nongraphic chars
-N--literalPrint entry names without quoting
-Q--quote-nameEnclose entry names in double quotes
--quoting-style=WORDliteral, locale, shell, shell-always, shell-escape, shell-escape-always, c, escape
--color[=WHEN]Colorize output: always, auto, never
-w--width=COLSSet output width
-T--tabsize=COLSSet tab stop size

Other

FlagLong FormDescription
-R--recursiveList subdirectories recursively
--authorWith -l, print author of each file
-D--diredGenerate output for Emacs dired mode
--helpDisplay help and exit
--versionOutput version and exit

Examples

# List all files with details, human-readable sizes
ls -lah

# List only directories
ls -d */

# Sort by modification time, newest first
ls -lt

# Sort by size, largest first
ls -lSh

# Recursive listing
ls -R

# Show inode numbers
ls -li

# One file per line (useful for scripting)
ls -1

# List with full timestamps
ls -l --full-time

# Ignore certain patterns
ls --ignore='*.pyc' --ignore='__pycache__'

# Show only hidden files
ls -d .*

# Natural version sort
ls -v file1.txt file10.txt file2.txt

Gotchas

  • Do not parse ls output in scripts. Filenames can contain spaces, newlines, and special characters that break parsing. Use find, stat, or shell globs instead.
  • -a shows . and .., -A does not. Use -A when you want hidden files but not the directory entries.
  • ls -l shows symlink info; add -L to see the target's info instead.
  • Color output may interfere with piping. Use --color=never when piping or --color=always to force color through pipes.
  • Default sort is locale-dependent. Set LC_ALL=C for byte-order sorting.
Repository
flox/floxenvs
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.