Home

Awesome

csvlens

csvlens is a command line CSV file viewer. It is like less but made for CSV.

Demo

Usage

Run csvlens by providing the CSV filename:

csvlens <filename>

Pipe CSV data directly to csvlens:

<your commands producing some csv data> | csvlens

Key bindings

KeyAction
hjkl (or ← ↓ ↑→ )Scroll one row or column in the given direction
Ctrl + f (or Page Down)Scroll one window down
Ctrl + b (or Page Up)Scroll one window up
Ctrl + d (or d)Scroll half a window down
Ctrl + u (or u)Scroll half a window up
Ctrl + hScroll one window left
Ctrl + lScroll one window right
Ctrl + ←Scroll left to first column
Ctrl + →Scroll right to last column
G (or End)Go to bottom
g (or Home)Go to top
<n>GGo to line n
/<regex>Find content matching regex and highlight matches
n (in Find mode)Jump to next result
N (in Find mode)Jump to previous result
&<regex>Filter rows using regex (show only matches)
*<regex>Filter columns using regex (show only matches)
TABToggle between row, column or cell selection modes
>Increase selected column's width
<Decrease selected column's width
Shift + ↓ (or Shift + j)Sort rows by the selected column
# (in Cell mode)Find and highlight rows like the selected cell
@ (in Cell mode)Filter rows like the selected cell
y (in Cell Mode)Copy the selected cell to clipboard
Enter (in Cell mode)Print the selected cell to stdout and exit
-SToggle line wrapping
-WToggle line wrapping by words
rReset to default view (clear all filters and custom column widths)
H (or ?)Display help
qExit

Optional parameters

Installation

Direct download

You can download the tar.xz or zip file matching your operating system from the releases page, extract it and execute the csvlens binary.

Homebrew

For macOS, csvlens is available on Homebrew. You can install it using:

brew install csvlens

Arch Linux

csvlens is available in the official repositories. You can install it using:

pacman -S csvlens

Windows

For Windows, csvlens is available on winget. You can install it using:

winget install --id YS-L.csvlens

FreeBSD

csvlens is available as a FreeBSD pkg. You can install it using:

pkg install csvlens

NetBSD

csvlens is available on pkgsrc. If you're using NetBSD you can install it using:

pkgin install csvlens

Cargo

If you have Rust installed, csvlens is available on crates.io and you can install it using:

cargo install csvlens

Or, build and install from source after cloning this repo:

cargo install --path $(pwd)