LangStop
ls
Ready
Editor

Configuration

List directory contents

Required
Flags & Options

Add flags from the picker below...

Tests

-l
Long format

Use a long listing format showing permissions, owner, size, and date (-l).

-1
One entry per line

List one file per line (-1).

-C
Multi-column

List entries in columns sorted vertically (-C). Default when output is a terminal.

-x
Multi-column (horizontal)

List entries in columns sorted horizontally (-x).

-m
Comma-separated

Fill width with a comma-separated list of entries (-m).

--format
Output format

Set output format explicitly (--format=WORD).

-a
Show hidden files

Do not ignore entries starting with . (-a / --all).

-A
Show hidden (exclude . and ..)

Like -a but do not list implied . and .. (-A / --almost-all).

-t
Sort by modification time

Sort by modification time, newest first (-t).

-S
Sort by size

Sort by file size, largest first (-S).

-X
Sort by extension

Sort alphabetically by file extension (-X).

-v
Natural sort

Natural sort of (version) numbers in file names (-v).

-r
Reverse sort order

Reverse order while sorting (-r / --reverse).

-U
No sorting

Do not sort; list entries in directory order (-U).

--sort
Sort by

Sort by the specified field (--sort=WORD).

--time
Time field

Which timestamp to use with -l or --sort=time (--time=WORD).

-h
Human-readable sizes

Print sizes in human-readable format (e.g. 1K, 234M, 2G) with -l (-h / --human-readable).

--si
SI sizes (powers of 1000)

Like -h but use powers of 1000 instead of 1024 (--si).

-k
Sizes in KiB

Default to 1024-byte block sizes (-k / --kibibytes).

-s
Print allocated blocks

Print the allocated size of each file in blocks (-s / --size).

--block-size
Block size

Scale sizes by the specified block size before printing (--block-size=SIZE).

-R
Recursive

List subdirectories recursively (-R / --recursive).

-d
List directories themselves

List directories themselves, not their contents (-d / --directory).

-i
Print inode number

Print the inode number of each file (-i / --inode).

-n
Numeric UID/GID

Like -l but list numeric user and group IDs (-n / --numeric-uid-gid).

-g
Omit owner

Like -l but do not list owner (-g).

-G
Omit group

In a long listing, do not print group name (-G / --no-group).

-o
Omit group (long format)

Like -l but do not list group information (-o).

-F
Classify entries

Append indicator (* / = > @ |) to entries (-F / --classify).

-p
Append / to directories

Append / indicator to directory entries (-p).

--file-type
File type indicators (no *)

Like -F but do not append * for executables (--file-type).

-L
Dereference symlinks

Show info for the file the symlink references, not the link itself (-L / --dereference).

--color
Color output

Colorize output based on file type (--color[=WHEN]).

-q
Hide non-printable characters

Print ? instead of non-graphic characters in file names (-q / --hide-control-chars).

-Q
Quote file names

Enclose file names in double quotes (-Q / --quote-name).

--hide
Hide pattern

Do not list entries matching the shell pattern (--hide=PATTERN). Overridden by -a or -A.

-I
Ignore pattern

Do not list entries matching the shell pattern (-I / --ignore=PATTERN).

--group-directories-first
Directories first

Group directories before files (--group-directories-first).

--time-style
Time style

Format timestamps in long listings (--time-style=STYLE).

-Z
SELinux context

Print any SELinux security context of each file (-Z / --context).

Live Output

Command
ls .

PRO TIP:Combine flags freely: ls -lAh --group-directories-first --color=auto

UTF-8
LangStop DevTools v1.0.0
;

LS Command Builder - Interactive Linux File Listing Tool

Meta Information

Title Tag: LS Command Builder | Interactive Linux File Listing Generator Meta Description: Build ls commands visually with our interactive generator. Create file listings with sorting, filtering, and formatting options without memorizing syntax. Free online Linux tool. Keywords: ls command generator, linux ls options, ls command builder, file listing tool, ls -la explained, ls sort by size, ls sort by date, linux directory listing


Structured Data (JSON-LD)

{
  "@context": "https://schema.org",
  "@type": "WebApplication",
  "name": "LS Command Builder",
  "description": "Interactive visual builder for Linux ls file listing commands",
  "applicationCategory": "DeveloperApplication",
  "operatingSystem": "Linux, macOS, Unix",
  "offers": {
    "@type": "Offer",
    "price": "0",
    "priceCurrency": "USD"
  },
  "featureList": [
    "Visual ls command generation",
    "Sorting options builder",
    "Filtering and formatting controls",
    "Human-readable size formatting",
    "Hidden file toggles",
    "Recursive listing options"
  ]
}

Main Content

What is the LS Command?

The ls command is the fundamental file listing utility in Linux and Unix-like operating systems. It displays directory contents including files, subdirectories, permissions, sizes, and modification dates [^11^].

Common Use Cases:

  • Navigate and explore directory structures
  • Check file permissions and ownership
  • Identify recently modified files
  • Sort files by size, date, or name
  • List hidden configuration files

Why Use This LS Command Builder?

Memorizing ls options can be challenging. Our visual builder helps you:

  • ✅ Generate commands without syntax errors
  • ✅ Understand each option with inline explanations
  • ✅ Copy production-ready commands instantly
  • ✅ Learn Linux file listing through interactive examples

Core Features

1. Display Format Options

Control how files appear in listings:

  • Long format (-l): Show permissions, owner, size, date [^12^]
  • Human-readable (-h): Display sizes in KB, MB, GB [^13^]
  • One per line (-1): Single column output
  • Comma-separated (-m): CSV-style output [^15^]

2. File Visibility Controls

Manage which files appear:

  • All files (-a): Include hidden files (dotfiles) [^14^]
  • Almost all (-A): Include hidden but exclude . and .. [^11^]
  • Directory only (-d): List directory info, not contents [^12^]

3. Sorting Options

Organize output by different criteria:

  • By time (-t): Newest files first [^13^]
  • By size (-S): Largest files first [^15^]
  • By extension (-X): Group by file type [^14^]
  • Reverse (-r): Invert sort order [^16^]

4. File Type Indicators

Visual file classification:

  • Classify (-F): Append */=>@| indicators [^11^]
  • Color (--color): Syntax highlighting by file type [^12^]
  • Inode (-i): Display file index numbers [^15^]

Common LS Command Patterns

Basic File Listing

# Simple directory listing
ls
 
# Detailed listing with permissions
ls -l
 
# All files including hidden
ls -la
 
# Human-readable sizes
ls -lh

Advanced Sorting

# Sort by modification time (newest first)
ls -lt
 
# Sort by size (largest first)
ls -lS
 
# Reverse chronological order
ls -ltr
 
# Sort by file extension
ls -lX

File Analysis

# Identify directories vs files
ls -F
 
# Show inode numbers
ls -i
 
# List only directories
ls -ld */
 
# Find recently accessed files
ls -ltu

LS Command Options Reference

Display Options

Option Description Example
-l Long listing format with details ls -l
-h Human-readable file sizes ls -lh
-a Show all files including hidden ls -la
-A Show hidden files except . and .. ls -lA
-d List directory itself, not contents ls -ld /var
-R Recursive listing of subdirectories ls -R
-1 One file per line ls -1

Sorting Options

Option Description Example
-t Sort by modification time ls -lt
-S Sort by file size ls -lS
-X Sort by extension ls -lX
-r Reverse sort order ls -lr
-u Sort by access time ls -lu
-c Sort by change time ls -lc
-v Natural sort of version numbers ls -v

Filtering Options

Option Description Example
-F Add type indicators (*/=>@|) ls -F
--color Colorize output ls --color=auto
-i Show inode numbers ls -i
-p Add / to directories ls -p
--group-directories-first List directories before files ls --group-directories-first

Output Formatting

Option Description Example
-m Comma-separated output ls -m
-Q Quote filenames ls -Q
-N Literal filenames (no quoting) ls -N
--time-style Custom time format ls -l --time-style=long-iso

Understanding LS Output

Long Format Columns

When using ls -l, each column represents [^12^]:

  1. Permissions (drwxr-xr-x): File type and access rights
  2. Links: Number of hard links
  3. Owner: User who owns the file
  4. Group: Group associated with the file
  5. Size: File size in bytes (or human-readable with -h)
  6. Date/Time: Last modification timestamp
  7. Name: File or directory name

File Type Indicators

  • -: Regular file
  • d: Directory
  • l: Symbolic link
  • c: Character device
  • b: Block device

FAQ

What is the difference between ls -l and ls -la?

ls -l shows detailed information but excludes hidden files (those starting with a dot). ls -la combines long format with the all-files option to include hidden configuration files like .bashrc and .gitignore [^14^].

How do I sort files by size in Linux?

Use ls -lS to sort by file size with largest files first. Combine with -r (ls -lSr) to reverse the order and show smallest files first [^15^].

What does ls -ltr do?

This combination shows a long listing sorted by time in reverse order. It displays the most recently modified files at the bottom, making it useful when the output spans multiple screen pages [^16^].

How can I see human-readable file sizes?

Add the -h flag to any long listing command: ls -lh. This converts byte counts to KB, MB, GB, or TB as appropriate [^13^].

What are hidden files in Linux?

Hidden files (dotfiles) begin with a period (.) and are not shown by default. They typically store configuration data. Use ls -a or ls -A to view them [^15^].

How do I list only directories?

Use ls -d */ to display only directory entries. The -d flag prevents listing directory contents, and */` matches only directory names [^14^].

Can I colorize ls output?

Yes, use ls --color=auto to enable color coding. Directories typically appear blue, executables green, and symbolic links cyan. Set alias ls='ls --color=auto' in your shell config to make this permanent [^12^].


Technical Specifications

  • Zero dependencies: Runs entirely in browser
  • No backend required: Static hosting compatible
  • Offline capable: Works without internet after initial load
  • Privacy focused: No data leaves your browser
  • Keyboard shortcuts: Full keyboard navigation support

Related Tools

  • chmod Permission Calculator
  • chown Owner Manager
  • find Command Builder
  • grep Pattern Generator
  • tar Archive Creator

Resources


Last Updated: 2025 License: Free to use Platform: Web-based, works on all modern browsers