DEV Community

Cover image for I Built cl: Stop Hunting Through Shell History
SPLTek
SPLTek

Posted on Edited on

I Built cl: Stop Hunting Through Shell History

I Built cl: Stop Hunting Through Shell History

A tiny personal command launcher that's saving me hours every week

The Problem

We've all been there. You're in the terminal, you need to run that one command
you used three weeks ago. It's not in your recent history. You start typing
variations, hunting through history | grep, checking scattered notes and gists...

Five minutes later, you finally find it. But you forgot it again.

I was spending roughly 10% of my terminal time searching for commands instead
of running them. So I decided to build something stupid-simple: cl.

The Solution

cl is a tiny personal command launcher. You save commands once with a simple name,
search them by typing a few letters, and run them with Enter.

That's it.

No configuration. No editor. Just:

  1. Ctrl+A → type a name → type the command → saved
  2. Open cl → search → hit Enter → command runs

How It Works

$ cl
# Opens an interactive picker

$ cl ssh
# Opens picker, pre-filtered to commands matching "ssh"

$ cl git push
# Opens picker, pre-filtered to commands matching "git push"
Enter fullscreen mode Exit fullscreen mode

When you pick a command, it runs immediately in your current shell. All output
goes to your terminal normally.

The Features

Save & Search

  • Save commands with human-readable names (spaces allowed)
  • Search case-insensitively by substring
  • Results show up instantly as you type

Placeholders (My Favorite)
Commands can include {{placeholder}} syntax:

# Save this command:
ssh {{user}}@{{host}}

# When you run it, cl prompts you:
user: admin
host: prod-server.com

# Then executes: ssh admin@prod-server.com
Enter fullscreen mode Exit fullscreen mode

With optional defaults:

git push {{remote:origin}} {{branch:main}}
Enter fullscreen mode Exit fullscreen mode

Just press Enter to accept the defaults, or type over them.

Toggle Display

  • Ctrl+S toggles whether commands are shown in the list
  • Enter always runs the command directly (the toggle only affects visibility)

Edit & Rename

  • Ctrl+E to edit a command
  • Ctrl+R to rename it
  • Ctrl+D to delete it (with confirmation)

Cross-Platform

  • macOS ✅
  • Linux ✅
  • Windows ✅

All commands are stored in JSON in your config directory (~/.config/cl on Linux,
~/Library/Application Support/cl on macOS, %AppData%\cl on Windows).

Why Go?

I wanted something tiny, fast, and single-binary. Go was perfect:

  • Compiles to a single, dependency-free binary
  • Cross-platform without hassle
  • Fast startup time
  • TUI libraries are excellent

The entire thing is ~2000 lines of Go. No magic, no dependencies beyond the CLI toolkit.

Installation

Homebrew (macOS/Linux)

brew install spltek/tap/cl
Enter fullscreen mode Exit fullscreen mode

Shell script (macOS/Linux)

curl -fsSL https://raw.githubusercontent.com/spltek/cl/main/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Downloads the right binary into ~/.local/bin.

PowerShell (Windows)

iwr https://raw.githubusercontent.com/spltek/cl/main/install.ps1 -UseBasicParsing | iex
Enter fullscreen mode Exit fullscreen mode

From source (requires Go 1.25+)

git clone https://github.com/spltek/cl
cd cl
make install-local
Enter fullscreen mode Exit fullscreen mode

Real-World Use Cases

For Developers:

# Database connections
psql -h {{host:localhost}} -p {{port:5432}} -U {{user}} -d {{db}}

# Docker commands
docker run -p {{port:3000}}:3000 {{image:node:18}}

# Git shortcuts
git stash pop
git rebase -i HEAD~10
Enter fullscreen mode Exit fullscreen mode

For DevOps:

# Kubernetes
kubectl logs {{pod}} -n {{namespace:default}}

# SSH to numbered servers
ssh deploy@prod-{{num:1}}.example.com
Enter fullscreen mode Exit fullscreen mode

For Anyone:

# Quick directory jump (needs && exec $SHELL)
cd ~/projects/important-project && exec $SHELL

# System commands
sudo systemctl restart {{service}}
Enter fullscreen mode Exit fullscreen mode

What's Next?

Right now cl is stable and does what I need. But I'm thinking about:

  • Better search (fuzzy matching?)
  • Tags/categories for commands
  • Command history/analytics
  • Sync across machines (?)

The goal is to keep it tiny and boring — just a tool that works.

Try It

If you spend time in the terminal and keep forgetting commands, give it a shot:

GitHub: https://github.com/spltek/cl

CL Command Launcher

I'm happy to answer questions in the comments or on the repo!


One More Thing

If this saves you time, consider leaving a ⭐ on GitHub. If it's useful and you
want to support development, you can also sponsor me on GitHub Sponsors.

Either way, I'd love to hear what you think!

Top comments (0)