A modern, feature-rich replacement for ls with colors, icons, and advanced display modes
Li is a powerful command-line utility that provides an enhanced replacement for the traditional ls command. Built with modern C++20 and std::filesystem, it offers beautiful colorized output, file type icons, multiple display modes, and extensive customization options without any external dependencies.
| Mode | Flag | Description |
|---|---|---|
| Grid | Default | Multi-column grid layout |
| Long | -l |
Detailed listing with permissions, owner, size, and date |
| Table | -n |
Clean table format with name and size |
| Two-Column | -N |
Compact two-column format |
| Tree | -k |
Hierarchical tree structure |
| Zebra | -z |
Alternating row colors for better readability |
- By Name:
-s name(default) - By Size:
-s sizeor-S - By Time:
-s timeor-t - By Extension:
-s extensionor-X - By Type:
-s type - Reverse:
-ror--reverse - Directories First:
-dor--dirs-first
- Color Support: ANSI color codes for different file types
- File Type Icons: Nerd Font compatible icons for quick identification
- Zebra Striping: Alternating row backgrounds in long format
- Git Integration: Shows branch name and status indicators
- Human Readable Sizes: Automatic unit conversion (K, M, G, T)
- Directories: Blue bold with 📁 icon
- Executables: Green bold with ⚙️ icon
- Symlinks: Cyan with 🔗 icon
- Sockets: Magenta with ⚡ icon
- Pipes: Yellow with 📘 icon
- Archives: Red with 📦 icon
- Images: Magenta with 🖼️ icon
- Code Files: Language-specific colors and icons
- Hidden Files: Dim gray
# Clone the repository
git clone https://github.com/Lotus-OS-Core/list-viewer.git
cd list-viewer
# Build the project
make
# Install system-wide (requires root)
sudo make install
# Or install to ~/.local
make install DESTDIR=~/.local# Compile
g++ -std=c++20 -O2 -Wall -Wextra -o li src/*.cpp
# Install binary
sudo cp li /usr/local/bin/
sudo chmod 755 /usr/local/bin/li
# Install man page
sudo cp doc/li.1 /usr/local/share/man/man1/
sudo mandb -q
# Install shell completions
sudo cp doc/completion/li.bash /usr/share/bash-completion/completions/
sudo cp doc/completion/li.zsh /usr/share/zsh/site-functions/_li# List current directory
li
# List specific directory
li /usr/bin
# List with long format
li -l
# List with human readable sizes
li -lh
# List all files including hidden
li -a# Recursive listing
li -R
# Tree view
li -k /usr
# Zebra striped listing
li -z
# Sort by size
li -lS
# Sort by modification time
li -lt
# Show git status
li --git
# Combine multiple options
li -lah --git# Long format
li -l
# Table format
li -n
# Two-column format
li -N
# Tree view with sizes
li -K
# Zebra mode
li -z# Disable icons
li --no-icons
# Force colors
li --color=always
# Disable colors
li --color=never
# Custom directory color
li --color-dirs=cyanCreate ~/.config/li/config.ini:
[general]
theme=dark
show_hidden=false
long_format=false
recursive=false
human_readable=true
dirs_first=true
show_icons=true
show_colors=true
sort_by=name
reverse_sort=false
time_style=long-iso
enable_git=true
[colors]
dir_color=blue
file_color=white
exec_color=green
link_color=cyan
special_color=yellowCOLUMNS: Override terminal column widthTERM: Terminal type for color detectionHOME: User's home directory for config lookup
| Short | Long | Description |
|---|---|---|
| (none) | --help |
Show help message |
-h, -H |
--human-readable |
Human readable sizes |
-v |
--version |
Show version information |
-c |
--config |
Use custom config file |
| Short | Long | Description |
|---|---|---|
-l |
--long |
Long listing format |
-1 |
(none) | One file per line |
-C |
(none) | List in columns (default) |
-x |
(none) | List by lines |
-n |
--table |
Table format |
-N |
--two-column |
Two-column format |
-k |
--tree |
Tree view |
-K |
(none) | Tree with sizes |
-z |
(none) | Zebra mode |
-Z |
(none) | Zebra with metadata |
| Short | Long | Description |
|---|---|---|
-a |
--all |
Show hidden files |
-A |
--almost-all |
Show hidden except . and .. |
-d |
--dirs-first |
Directories first |
-f |
(none) | No sort, enable -a |
| Short | Long | Description |
|---|---|---|
-r |
--reverse |
Reverse sort order |
-t |
(none) | Sort by time |
-S |
(none) | Sort by size |
-X |
(none) | Sort by extension |
-s |
--sort=TYPE |
Sort by type |
| Short | Long | Description |
|---|---|---|
-i |
--inode |
Show inode numbers |
-H |
--human-readable |
Human readable sizes |
| (none) | --si |
SI units (1000 not 1024) |
| (none) | --stats |
Show statistics |
| (none) | --git |
Show git status |
| Short | Long | Description |
|---|---|---|
-F |
--classify |
Add type indicators |
| (none) | --no-icons |
Disable icons |
| (none) | --icons=WHEN |
Icon mode (always/auto/never) |
| (none) | --color=WHEN |
Color mode (always/auto/never) |
| (none) | --time-style=STYLE |
Time format |
| Feature | ls | li |
|---|---|---|
| Basic listing | ✓ | ✓ |
| Long format | ✓ | ✓ |
| Hidden files | ✓ | ✓ |
| Recursive | ✓ | ✓ |
| Tree view | ✗ | ✓ |
| Zebra striping | ✗ | ✓ |
| File icons | ✗ | ✓ |
| Git status | ✗ | ✓ |
| Colors | ✓ | ✓ (enhanced) |
| Configuration file | ✗ | ✓ |
| Shell completion | ✗ | ✓ |
| Platform | Status | Notes |
|---|---|---|
| Linux | ✅ Full Support | Primary target |
| macOS | ✅ Full Support | Minor differences |
| BSD | ✅ Supported | POSIX compatibility |
| Windows | Native not supported |
- C++20 compatible compiler (g++ or clang++)
- Standard C++ library
- POSIX system calls
No external dependencies required!
# Debug build
make debug
# Release build (optimized)
make release
# Clean build artifacts
make clean# Run tests
make testThe codebase is organized into modular components:
src/
├── main.cpp # Entry point and orchestration
├── Args.hpp # Command-line argument parsing
├── FileSystem.hpp # Filesystem operations
├── Display.hpp # Rendering engine
├── Theme.hpp # Colors and icons
├── Utils.hpp # Utility functions
├── Git.hpp # Git integration
└── Config.hpp # Configuration parsing
# Check terminal support
echo $TERM
# Force colors
li --color=always- Install a Nerd Font: https://www.nerdfonts.com/
- Or disable icons:
li --no-icons
# Update man database
mandb -q
# View man page
man liFor large directories, use:
li -1 # Single column
li --no-icons # Disable icons
li --no-colors # Disable colors- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
LotusOS Core
- Inspired by the ms_replace_ls project - "Same Creator"
- Nerd Fonts for icon support
- The Linux community for inspiration
LotusOS Core - 2025,2026