LinuxCommandLibrary

colorls

List directory contents with colors and icons

TLDR

List files one per line

$ colorls -1
copy

List all files, including hidden files
$ colorls --all
copy

Long format list (permissions, ownership, size, and modification date) of all files
$ colorls --long --all
copy

Only list directories
$ colorls --dirs
copy

SYNOPSIS

colorls [OPTIONS] [PATH...]
Example: colorls -l --sort-files ~/Documents
Example: colorls --tree .

PARAMETERS

--all, -a
    Do not ignore entries starting with '.'.

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

--tree, -t
    Display directory contents in a tree-like structure.

--sort-dirs, -sd
    Sort directories first, then files, preserving sub-sorting.

--git-status, -g
    Show Git status indicators (modified, untracked, added files).

--report, -r
    Show a Git status report summary.

--exclude-dirs=PATTERNS, -D PATTERNS
    Exclude directories matching specified patterns.

--exclude-files=PATTERNS, -F PATTERNS
    Exclude files matching specified patterns.

--light-colors
    Use a lighter color scheme for improved readability on dark terminals.

--dark-colors
    Use a darker color scheme for improved readability on light terminals.

--ignore-case, -i
    Ignore case when sorting entries.

--sort-date, -d
    Sort entries by modification date.

--sort-size, -s
    Sort entries by size, largest first.

--sort-reverse, -R
    Reverse the order of the sort.

--files, -f
    List only files, excluding directories.

--dirs, -di
    List only directories, excluding files.

--help, -h
    Display help message and exit.

--version, -v
    Display version information and exit.

DESCRIPTION

colorls is an open-source Ruby gem that serves as a highly visual and functional alternative to the traditional ls command in Unix-like operating systems. It aims to enhance the command-line experience by providing a rich, color-coded output that includes syntax highlighting for various file types, Font Awesome icons for files and directories, and integrated Git status indicators. Unlike ls, colorls offers immediate visual cues about file permissions, ownership, size, and modification dates, alongside a clear representation of Git repository changes (modified, untracked, added files). Its features extend to tree-view listings, intelligent sorting options, and customizable output. While offering significant aesthetic and informational improvements, colorls requires a Ruby environment and a compatible font (like Nerd Fonts) for full icon display, making it a popular choice for developers seeking a more informative and visually appealing directory listing tool.

CAVEATS

Requires Ruby and RubyGems installed on the system.
Full icon display depends on a font with Font Awesome glyphs (e.g., Nerd Fonts) being configured in the terminal. Without it, icons may appear as broken characters.
For very large directories, colorls might be slightly slower than the native ls command due to additional processing for icons, colors, and Git status.
It is not a direct drop-in replacement for all ls aliases due to its distinct set of options.

INSTALLATION

To install colorls, ensure Ruby and RubyGems are installed, then execute: gem install colorls. It is recommended to install it globally or manage with rvm/rbenv.

FONT REQUIREMENT

For colorls to display icons correctly, your terminal font must support Font Awesome glyphs. Popular choices include Nerd Fonts which patch common programming fonts to include a wide range of icons, including those used by colorls. Without a compatible font, icons will likely render as generic replacement characters.

CONFIGURATION

colorls allows extensive customization of its output, including icon mappings and color schemes, through YAML configuration files typically located in ~/.config/colorls/. Users can define custom rules for file types, create personalized themes, and fine-tune its behavior.

HISTORY

colorls emerged as an open-source project, primarily developed as a Ruby gem, in response to the growing demand for more visually appealing and informative command-line tools. It gained traction among developers and power users who sought to enhance their terminal workflow beyond the capabilities of the traditional ls command. Its development leveraged Ruby's flexibility to parse file system information and integrate with external libraries like Font Awesome for icons and Git for status reporting. The project's evolution has been community-driven, with contributions continually refining its features, performance, and customization options, establishing it as a popular choice in the ecosystem of modern CLI utilities.

SEE ALSO

ls(1), exa(1), lsd(1), dircolors(1)

Copied to clipboard