Skip to content

zuedev/zls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

This project is currently under heavy development and is not yet ready for production use.
The API and implementation may change frequently. Use with caution in non-production environments.

zls

⚡ A blazingly fast ls replacement written in Rust

zls (zuedev's ls) is a modern, high-performance replacement for the traditional ls command. Built with Rust for speed and reliability, it features parallel directory processing, colorized output, and intuitive file type indicators.

Features

Installation

From Source

git clone https://github.com/zuedev/zls.git
cd zls
cargo install --path .

Using Docker

# Build the image
docker build -t zls .

# Run zls in a container
docker run --rm -v $(pwd):/data zls /data

From GitHub Container Registry

docker pull ghcr.io/zuedev/zls:main
docker run --rm -v $(pwd):/data ghcr.io/zuedev/zls:main /data

Usage

zls [OPTIONS] [PATH]

Options

Flag Long Form Description
-a --all Show hidden files (starting with .)
-s --short Use compact listing format with column layout
-t --time Sort by modification time (newest first)
-H --human Show human-readable sizes (default: enabled)
--bytes Show raw byte sizes instead of human-readable
-h --help Print help information
-V --version Print version information

Examples

# List current directory (detailed view)
zls

# List with hidden files
zls -a

# Compact view sorted by modification time
zls -st

# Show raw byte sizes
zls --bytes

# List specific directory
zls /usr/local/bin

Output Formats

Detailed View (Default)

d      4.1K Dec 25 10:30 src/
-      1.2K Dec 25 10:25 Cargo.toml
-      8.5K Dec 25 10:29 main.rs

Format: [type] [size] [modified] [name]

  • Type: d for directory, - for file
  • Size: Human-readable by default (B/K/M/G/T)
  • Modified: MMM DD HH:MM format
  • Name: Color-coded by file type

Short View (-s)

src/  Cargo.toml  main.rs  target/  README.md

Responsive column layout that adapts to terminal width.

Performance

zls uses parallel processing via Rayon to read directory entries concurrently, making it significantly faster than traditional ls for directories with many files. The performance improvement is most noticeable with:

  • Large directories (100+ files)
  • Network-mounted filesystems
  • Directories with mixed file types

Development

Running Tests

cargo test

Running Benchmarks

# Run all benchmarks
cargo bench

# Run specific benchmark group
cargo bench format_size
cargo bench directory_reading
cargo bench sorting

The benchmark suite includes:

  • Size formatting - Performance comparison between human-readable and raw byte formatting
  • Time formatting - Date/time string formatting performance
  • File info creation - FileInfo struct creation from filesystem metadata
  • Directory reading - Sequential vs parallel directory processing comparison
  • Sorting - Name vs modification time sorting performance

Benchmark results are saved to target/criterion/ with detailed HTML reports.

Building

# Debug build
cargo build

# Release build
cargo build --release

Code Coverage

The project includes comprehensive unit tests covering:

  • Size formatting (human-readable and raw bytes)
  • Time formatting and edge cases
  • File type detection (hidden files, directories)
  • Size conversion edge cases

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Dependencies

  • clap (4.0+) - Command-line argument parsing
  • crossterm (0.27) - Cross-platform terminal manipulation and colors
  • rayon (1.7) - Data parallelism library
  • chrono (0.4) - Date and time handling

License

This project is open source and dedicated to the public domain under the Unlicense.

Acknowledgments

  • Inspired by modern CLI tools like exa and lsd
  • Built with the Rust ecosystem's excellent crates
  • Optimized for developer workflow and terminal aesthetics

About

⚡ A blazingly fast ls replacement written in Rust with parallel processing and colorized output

Topics

Resources

License

Stars

Watchers

Forks

Packages