command
popular.zsh — bookmark, template, and run zsh commands

Tiny zsh shortcuts for saving, running, and templating your most-used commands — with AES-256-CBC encrypted secret placeholders kept out of exported files.

curl -fsSL https://raw.githubusercontent.com/sajjadRabiee/popular-zsh/main/install.sh | zsh
padd p pls psecret pedit pupdate pcli plock psecret-reset

What you get

padd / paddh

Save commands by name, or grab a line straight from your shell history by event number.

— hover to preview
p

Run a saved command. Templates expand {{opt}}, [[pos]], and <<secret>> before exec.

— hover to preview
pls

Browse saved commands with template hints and secret markers shown inline.

— hover to preview
psecret

Store sensitive values encrypted with AES-256-CBC. A master password is prompted once per session and cached in memory — never written to disk.

— hover to preview
plock

Clear the cached master password from the current shell session. The next secret access will re-prompt.

— hover to preview
pedit

Edit the full store or a single command in your preferred editor ($EDITOR or vim).

— hover to preview
pcli

Drop into a sub-shell where saved names work directly — no p prefix. Tab completion included.

— hover to preview
pexport / pimport

Back up, share, or merge command stores. Import directly from a GitHub repo with -R. Exports never include secrets — safe to commit.

— hover to preview
psecret-migrate

Upgrade a v1 plain-text secrets file to the v2 AES-256-CBC encrypted format in one command.

— hover to preview
psecret-reset

Change your master password and re-encrypt every secret in place. If the old password is lost, wipes all secrets and starts fresh — no way to recover without the original key.

— hover to preview
pupdate

Pull the latest popular.zsh and all modules from GitHub in one command.

— hover to preview

Templates

Three placeholder styles let you turn saved commands into small, reusable generators.

Syntax Style How to pass a value
{{name}} Named option p cmd --name=value
[[name]] Positional p cmd value (left-to-right order)
{{name:default}} Option with default Omit the flag to use the stored default
[[name:default]] Positional with default Omit the arg to use the stored default
<<key>> Secret (encrypted) Set once with psecret -g key; encrypted at rest, never in exports

Positional [[port]]

zsh
$ padd serve 'python3 -m http.server [[port]]'
$ p serve 8000

Named option {{port}}

zsh
$ padd serve2 'python3 -m http.server {{port}}'
$ p serve2 --port=8000

Mixed positional + option

zsh
$ padd hit 'curl -s http://[[host]]:{{port}}/'
$ p hit localhost --port=8080

Secret <<token>>

zsh
$ padd hook 'curl -H "Auth: Bearer <<token>>" $URL'
$ psecret -g token
master password: ••••••••
Enter value for token: ••••••••
$ p hook    # token injected at runtime

Encryption

Secret values are encrypted at rest with AES-256-CBC (openssl, PBKDF2). A master password is prompted the first time you access secrets in a shell session and cached in memory — it is never written to disk.

Requires openssl on your PATH (pre-installed on macOS; apt install openssl on Linux).

Step 1 — Store a secret
First use: set your master password

On first psecret call, you are prompted for a master password. All subsequent secrets in that session use it without prompting again.

Step 2 — Run a command
Secrets are decrypted at runtime

When you run p <name>, each <<key>> placeholder is decrypted on the fly and substituted before exec.

Step 3 — Lock when done
plock clears the cached key

Run plock to wipe the master password from memory. The next secret access will prompt again.

Migration — upgrading
psecret-migrate: v1 → v2

Already have secrets? Run psecret-migrate once to re-encrypt the file under AES-256-CBC. A .bak is kept until you remove it.

Password change
psecret-reset: rekey or wipe

Run psecret-reset to change your master password. If you still have the old one, all secrets are re-encrypted in place. If the old password is lost, secrets are wiped and you start fresh.

pcli — interactive popular shell

Drop into a sub-shell where every saved name works as a first-class command. A [p] badge appears on the right side of your prompt so you always know you're inside the session. Tab completion is fully available. Type bye to return to your normal shell.

zsh
$ pcli
  popular shell — saved names work directly · bye to exit

sajjad@mac ~ [p]
 gs             # runs your saved "gs" command directly
On branch main · nothing to commit

 list           # alias for pls
 add up 'docker compose up -d'
 up             # runs it immediately
 bye
addpadd
addhpaddh
listpls
removepremove
editpedit
updatepupdate
secretpsecret
secret-resetpsecret-reset
savepexport
loadpimport
helpphelp
byeexit

Storage

Commands and secrets live in two separate files. Both paths can be overridden with environment variables.

Commands ~/.popular_commands
Secrets ${POPULAR_COMMANDS_FILE}.secrets  (chmod 600 · AES-256-CBC encrypted)

Each command line is name|command. pexport only writes the commands file — never the secrets file — so exports are safe to share or commit to version control.

Try it — command playground

Select a command, fill in the arguments, and run it to see realistic simulated output.

popular.zsh playground

← Select a command and click Run.

Other shells

popular.zsh is written for zsh, but bash, fish, and nushell users can use it too — as long as zsh is installed. The installer injects thin wrapper functions automatically. All shells share the same backing file.

~/.bashrc
# Add to ~/.bashrc
_p_zsh() { zsh -c "source ~/.popular-zsh/popular.zsh 2>/dev/null && \"\$@\"" -- "$@"; }
p()       { _p_zsh p       "$@"; }
padd()    { _p_zsh padd    "$@"; }
pls()     { _p_zsh pls     "$@"; }
premove() { _p_zsh premove "$@"; }
pedit()   { _p_zsh pedit   "$@"; }
psecret() { _p_zsh psecret "$@"; }
plock()   { _p_zsh plock          ; }
pupdate() { _p_zsh pupdate        ; }
pcli()    { zsh -i -c "source ~/.popular-zsh/popular.zsh 2>/dev/null && pcli"; }
~/.config/fish/config.fish
# Add to config.fish
function _p_zsh
    set cmd $argv[1]; set -e argv[1]
    zsh -c "source ~/.popular-zsh/popular.zsh 2>/dev/null && $cmd \"\$@\"" -- $argv
end
function p;       _p_zsh p       $argv; end
function padd;    _p_zsh padd    $argv; end
function pls;     _p_zsh pls     $argv; end
function psecret; _p_zsh psecret $argv; end
function plock;   _p_zsh plock;         end
function pupdate; zsh -c "source ~/.popular-zsh/popular.zsh 2>/dev/null && pupdate"; end
function pcli;    zsh -i -c "source ~/.popular-zsh/popular.zsh 2>/dev/null && pcli"; end
~/.config/nushell/config.nu
# Add to config.nu
def p [...rest] { zsh -c $"source ~/.popular-zsh/popular.zsh && p ($rest | str join ' ')" }
def padd [...rest] { zsh -c $"source ~/.popular-zsh/popular.zsh && padd ($rest | str join ' ')" }
def pls [...rest] { zsh -c $"source ~/.popular-zsh/popular.zsh && pls ($rest | str join ' ')" }
def pcli [] { zsh -i -c "source ~/.popular-zsh/popular.zsh && pcli" }

Command Packs

A popular-pack is any GitHub repo with a commands.pop file in the standard name|command format. Import any pack directly — no download, no copy-paste.

sajjadRabiee / popular-zsh-pack
The official starter pack — 1 000 everyday shell commands
1 000 commands
git docker kubernetes aws terraform python node postgres redis security network system go rust helm ansible java macos
preview — popular-zsh-pack
$ pls
gs          git status
dps         docker ps
kgpa        kubectl get pods -A
aws-ls      aws s3 ls s3://[[bucket]]/
tfinit      terraform init
psql-conn   psql -h [[host]] -U [[user]] -d [[db]]
redis-get   redis-cli get [[key]]
nmap-scan   nmap -sV -sC -oN [[output]] [[target]]
  … and 992 more
pimport -R sajjadRabiee/popular-zsh-pack
View on GitHub ↗

Ship your own pack: create a repo, add a commands.pop file, and share pimport -R owner/repo with your team. Any branch or raw URL works.