Skip to main content

L command

l command is a smart file and directory viewer that can replace both less and ls. It intelligently detects the content type and displays it in the most appropriate way.

Usage

  • l /path/to/file: Display file content appropriately
    • PDF files: Extract and display text content using pdfminer.six
    • Image files: Display in terminal using timg or show metadata
    • Audio/Video files: Show detailed metadata using ffprobe
    • XML/HTML files: Format and validate using xmllint
    • CSV/TSV files: Display structured table with column information
    • Markdown files: Render using glow, mdcat, or pandoc
    • YAML files: Format and validate using yq with color output
    • JSON files: Format and display using jq
    • Archive files: List contents using appropriate tools (unzip -l, tar -tvf)
    • Binary files: Display using hexdump -C
    • Text files: Short files via cat, long files via less -RFX
  • l /path/to/directory: Works as ls -la --color=auto /path/to/directory

Detailed Behavior

File Type Detection and Processing

The tool uses a priority-based handler system to process different file types:

Priority Order: Image (65) > PDF (60) > Media (55) > JSON (50) > XML/HTML (45) > CSV (40) > Markdown (35) > YAML (30) > Archive (80) > Binary (20) > Default (0)

PDF Files (Priority: 60)

  • Extensions: .pdf
  • Content Detection: Files starting with %PDF-
  • Processing: Extract text using pdfminer.six, display metadata and content
  • Fallback: Show file information when pdfminer.six is unavailable

Image Files (Priority: 65)

  • Extensions: .png, .jpg, .jpeg, .gif, .bmp, .webp, .tiff, .tif
  • Content Detection: Magic bytes for PNG, JPEG, GIF, BMP, WebP, TIFF
  • Processing: Display in terminal using timg, show dimensions and metadata
  • Fallback: Show file information and dimensions when timg is unavailable

Audio/Video Files (Priority: 55)

  • Extensions: Audio (.mp3, .flac, .wav, .aac, .ogg, .m4a, .wma), Video (.mp4, .mkv, .avi, .mov, .wmv, .flv, .webm, .m4v, .3gp)
  • Processing: Analyze using ffprobe to show format, duration, bitrate, streams, and metadata
  • Fallback: Show basic file information when ffmpeg is unavailable

XML/HTML Files (Priority: 45)

  • Extensions: .xml, .html, .htm, .xhtml, .svg, .xsl, .xslt
  • Content Detection: XML declaration, DOCTYPE, or XML/HTML tag patterns
  • Processing: Format using xmllint --format, validate syntax
  • Fallback: Show raw content when xmllint is unavailable

CSV/TSV Files (Priority: 40)

  • Extensions: .csv, .tsv, .txt (with CSV content detection)
  • Content Detection: Consistent delimiter patterns across lines
  • Processing: Display structured table with column headers and data preview
  • Features: Auto-detect delimiters (comma, tab, semicolon, pipe), show row/column counts

Markdown Files (Priority: 35)

  • Extensions: .md, .markdown, .mdown, .mkd, .mdx
  • Processing: Render using glow (with smart paging), mdcat, or pandoc
  • Features: Smart paging based on content length, syntax highlighting fallback with bat
  • Fallback: Show source with syntax highlighting

YAML Files (Priority: 30)

  • Extensions: .yaml, .yml
  • Content Detection: YAML document markers (---, %YAML) or YAML structure patterns
  • Processing: Format using yq --colors, validate syntax
  • Fallback: Show raw content with syntax highlighting when yq is unavailable

JSON Files (Priority: 50)

  • Extensions: .json
  • Content Detection: Files starting with { or [ (UTF-8 encoded)
  • Processing: Format using jq --color-output, validate syntax
  • Features: Size limit check (10MB), smart paging
  • Fallback: Show raw content for invalid JSON or when jq is unavailable

Archive Files (Priority: 80)

  • Extensions: ZIP (.zip, .jar, .war, .ear, .apk, .ipa), TAR (.tar.gz, .tgz, .tar.bz2, .tbz2, .tar.xz, .txz, .tar.zst)
  • Processing: List contents using unzip -l or tar -tvf
  • Features: Smart paging for large archive listings

Binary Files (Priority: 20)

  • Detection: Uses file command or content-based detection (null bytes, non-printable characters)
  • Processing: Display using hexdump -C
  • Features: Handles various binary formats

Text Files (Default Priority: 0)

  • Processing: Automatically detects file size and line count
  • Features: Uses cat for short files, less -RFX for long files
  • Smart Paging: Compares file line count with terminal height

Options

Currently, the command line arguments are as follows:

  • Positional argument path: Path to the file or directory to display (default: current directory .)

Use Cases

  • View file content quickly: l file.txt
  • Check directory contents: l ./myfolder
  • Read PDF documents: l document.pdf
  • View images in terminal: l image.png
  • Analyze media files: l video.mp4 or l audio.mp3
  • Format structured data: l data.json, l config.yaml, l data.csv
  • Read documentation: l README.md
  • Validate markup: l page.html, l config.xml
  • Inspect archives: l archive.zip, l backup.tar.gz
  • Debug binary files: l binary.bin

Optional Dependencies

For enhanced functionality, install these optional tools:

  • PDF support: pip install pdfminer.six
  • Image display: Install timg via your package manager
  • Media analysis: Install ffmpeg (includes ffprobe)
  • XML formatting: Install libxml2-utils (includes xmllint)
  • Markdown rendering: Install glow, mdcat, or pandoc
  • YAML processing: Install yq
  • Syntax highlighting: Install bat for enhanced fallback display

The tool gracefully handles missing dependencies by showing basic file information and falling back to appropriate display methods.

Metadata

Release files for l-command 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for l-command 0.3.0
File Size Uploaded Provenance Actions
l_command-0.3.0.tar.gz 21.0 kB With provenance Details for l_command-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for l-command 0.3.0
File Interpreter ABI Platform Actions
l_command-0.3.0-py3-none-any.whl Python 3 none any Details for l_command-0.3.0-py3-none-any.whl

Total release size: 54.2 kB

Release files / l_command-0.3.0.tar.gz

Download URL l_command-0.3.0.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a4fe229aaeade00d7f6ee3d234f75428d8363bdb0118d6f78129e1281a9565b4
BLAKE2b-256 checksum
How to use checksums
82a8e22f8ca73b259324c6d963285d51542433617cae061df947fe0ed6f37319
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2025.

Transparency log

Release files / l_command-0.3.0-py3-none-any.whl

Download URL l_command-0.3.0-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac6bd48f3f24692650e295d2158853a07c51e99e4661fe1d272dc409b093773d
BLAKE2b-256 checksum
How to use checksums
baf1a8fa37a8291eeb25d4c74117e62591c59a41272809f545b92972ae54f0cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2025.

Transparency log

Security for l-command 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for l_command-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 5, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page