- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| bash | ||
| yazi | ||
| .gitignore | ||
| bashrc.example | ||
| DOCUMENTATION.md | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
🍞 ButterBash
A .bashrc split into small files you can actually read. You get a
git-aware prompt, a few safer defaults, fzf and zoxide wired in, and a
handful of functions worth having, plus git and apt aliases you can trim.
Install
git clone https://justaguy.dev/drew/butterbash.git
cd butterbash
./install.sh
The installer backs up your .bashrc and any existing ~/.config/bash,
copies the new files in, installs the tools it relies on through your
package manager. Open a new
terminal when it finishes.
ButterBash is also option 1 in the butterscripts optional tools menu.
To undo it, put the backup back:
cp ~/.bashrc.backup.<timestamp> ~/.bashrc
rm -rf ~/.config/bash
What you get
Prompt
18:42:07 drew at box in ~/Code/butterbash (main*)
✔ $
Time, user, host, directory, and the git branch with * when the tree is
dirty. The second line shows ✔, or ✘ and the exit code, for the last
command. [ssh] shows in red on remote sessions. Once per session a header
line prints the OS, kernel, window manager and bash version.
Aliases
The core set only changes how commands you already type behave, so there is nothing to memorize:
.. ... .... - |
up one, two, three, back |
ls l ll la lt lh |
eza with icons and directories first, plain ls if eza is missing |
cp mv rm mkdir |
ask before overwriting, rm -I, mkdir -p, all verbose |
df du free |
human-readable sizes |
grep |
color |
top |
btop, then htop, then top |
bashrc reload |
edit or re-source ~/.bashrc |
ff hi |
fastfetch, a desktop notification |
On top of that come extra sets with names of their own. git and apt are on,
shortcuts is off. Pick yours on this line in ~/.bashrc, then reload:
BUTTERBASH_EXTRAS=(git apt)
| Set | Adds |
|---|---|
git |
g gs ga gaa gc gcm gp gpu gpl gco gb gd gl gclone |
apt |
inst search update upgrade remove uplist autoremove |
shortcuts |
editors v vv e n, one-letter x c h j, mem cpu biggest myip listening k9 now week, switch to zsh and back |
Navigation
zoxide takes over cd. Full paths, - and .. work as before, and
cd <fragment> jumps to the best-matching directory you have been in.
cdi opens an fzf picker with a preview. Typing a directory name on its
own also changes into it.
y runs yazi and leaves the shell in whatever directory you quit from.
Functions
mkcd dir |
make it and go there |
extract file |
any archive: tar, gz, bz2, xz, zst, zip, rar, 7z |
backup file |
timestamped copy next to the original |
calc 2+2 |
bc with two decimals |
sysinfo |
host, OS, kernel, uptime, memory, load, disk |
psg name |
ps aux filtered, header kept |
hgrep term |
search history |
dirsize [dir] |
one number |
path |
PATH, one entry per line |
vf |
fzf a file with preview, open in $EDITOR |
fkill |
fzf a process, kill it |
Keys
| Up / Down | history filtered by what you have typed so far |
| Ctrl+R | fzf history search |
| Ctrl+T | fzf file picker, pastes the path |
| Alt+C | fzf directory picker, cd into it |
| Ctrl+L | clear |
Shell options
History holds 10,000 entries in memory and 20,000 on disk, written after
every command, with duplicates and the usual noise (ls, cd, exit)
dropped. autocd, cdspell, globstar and case-insensitive globbing are
on. Man pages are colored. EDITOR picks the first of nvim, vim, micro,
nano that exists.
Make it yours
- Any
*.bashfile you drop into~/.config/bash/loads on the next shell.custom.bashis a fine name. Re-running the installer keeps it. ~/.bashrc.localloads last and is for machine-specific exports and aliases. The installer never touches it.- The shipped files are short. Edit them, but know that re-running the installer swaps in fresh copies (yours stay in the backup).
Files
~/.config/bash/
├── aliases.bash core aliases
├── prompt.bash prompt and session header
├── keybinds.bash readline bindings
├── fzf.bash fzf options, vf, fkill
├── zoxide.bash cd and cdi
├── yazi.bash y
├── functions/
│ ├── system.bash sysinfo, psg, install_tools
│ └── utils.bash mkcd, extract, backup, calc, hgrep, dirsize, path
└── optional/ extras, loaded only if listed in BUTTERBASH_EXTRAS
├── git.bash
├── apt.bash
└── shortcuts.bash
Requirements
Bash 4 or newer. The installer pulls in fzf, ripgrep, fd, bat, eza and zoxide with apt, dnf, pacman or brew, and every file checks for its tool before doing anything, so a missing one just means that feature is off.
Not installed for you: yazi for y, and xclip or wl-clipboard for
clipboard use. A starter ~/.config/yazi/theme.toml that follows your
terminal colors is dropped in if you have none.
Related
- ButterZsh, the same idea for zsh
- butterscripts, Debian setup scripts that can install this
- ButterNotes, notes and todos from the shell
Contributing
Issues and pull requests at https://justaguy.dev/drew/butterbash. For anything larger than a fix, open an issue first.
Support
Connect
- YouTube — tutorials and guides
- Butterforge — source code and projects
- Butter desktops — ready-to-use window manager desktops for Debian
- The Butter Lab — Discourse forum
- The Churn — community chat (Fluxer)
- Wiki — documentation and guides
- Mastodon — @justaguylinux@fosstodon.org
- Butterbian — a maintained Debian derivative built on Debian stable
License
GPL-2.0. See LICENSE.
Made with 🧈 by JustAGuyLinux
