Plain Bash, Zsh-flavored

zsh-like-bash (zlb)

A small collection of Bash scripts that bring the quality-of-life features people love about Zsh — an informative prompt, a z-style directory jumper, better history, and handy aliases — to plain Bash.

Get started Browse CLI reference
bash
curl -fsSL https://raw.githubusercontent.com/4msar/zsh-like-bash/main/install | bash

What's inside

Six independent scripts. Source only what you want.

prompt.sh

Two-line, color-coded prompt: shortened cwd, Git branch with dirty/clean status and ahead/behind counts, last command duration and exit status.

z.sh

A lightweight z command that jumps to frequently/recently used directories by partial name. No external dependencies.

history.sh

Saner Bash history defaults: dedup, larger history size, append instead of overwrite, multi-line command support.

completion.sh

Loads system Bash completion and enables Zsh-like conveniences: autocd and cdspell.

aliases.sh

Common shortcuts for navigation (.., ...), ls variants, and Git (gs, ga, gc, gp...).

functions.sh

Handy functions: mkcd, extract, git-branch-name, and the zlb-* management commands.

Installation

One command, or clone it yourself and pick what you want.

Quick install

curl -fsSL https://raw.githubusercontent.com/4msar/zsh-like-bash/main/install | bash

Clones the repo to ~/.bash and appends a snippet to ~/.bashrc (between # >>> zsh-like-bash >>> / # <<< zsh-like-bash <<< markers) that sources every *.sh file in ~/.bash/. Re-running the installer later just pulls the latest changes.

source ~/.bashrc

Manual installation

git clone https://github.com/4msar/zsh-like-bash.git ~/.bash

echo '# >>> zsh-like-bash >>>' >> ~/.bashrc
echo "source ~/.bash/init" >> ~/.bashrc
echo '# <<< zsh-like-bash <<<' >> ~/.bashrc

Pick and choose which files to source — each script is independent.

CLI reference

Every command, function, and alias zlb adds to your shell.

z — directory jumper

Records every directory you visit (via a hook in prompt.sh's PROMPT_COMMAND) into ~/.bash/z-data/directories. Requires prompt.sh to be sourced too.

z foo Jump to the best-matching visited directory containing "foo"
z foo bar Match a directory containing both "foo" and "bar"
z Go home
z - Go to the previous directory (like cd -)
z /abs/path Behaves like cd /abs/path

Functions — functions.sh

generate_password Generate a random password (openssl rand -hex 16)
clear_git_branches Fetch and prune, then force-delete local branches whose upstream is gone
remove_ds_store Recursively delete .DS_Store files from the current directory
zlb-update git pulls the latest zsh-like-bash changes into its install directory
zlb-help Print available functions and aliases. Use zlb-help --aliases to list just the Git/nav aliases

Aliases — aliases.sh

Navigation & listing
..cd ..
...cd ../..
....cd ../../..
llls -lah --color=auto
lals -A --color=auto
lls -CF --color=auto
clsclear
grepgrep --color=auto
myipShow your public IP details via ipinfo.io
myipconfigShow full IP config JSON via ifconfig.me
Git
gs / gstgit status
gagit add
gaagit add --all
gcgit commit
gcmgit commit -m
gp / gplgit push / git pull
glgit log --oneline --graph --decorate --all
gd / gdsgit diff / git diff --staged
gb / gbagit branch / git branch -a
gco / gswgit checkout / git switch
gcbgit switch -c
gr / grsgit restore / git restore --staged

Requirements