This is a collection of my bash prompt settings, aliases, exports, and other related shell scripts.
- Exposes the
XDG Base Directoryspecification variables. - Supports loading
bashshell parts based on host operating system:bash_linux- For Linux platforms.bash_osx- For macOS platforms (supportsbash-completionv1 and v2).
- Loads common definitions from:
bash_exports- Environment variables.bash_aliases- Aliases.bash_functions- Functions.
- Displays "information lines" in shell:
gitworking state information.screensession name.
- Understands various tools and tooling in shell:
- 1Password CLI support.
direnvsupport.fnmsupport.pnpmsupport.
- Weekly
VERSIONcheck against GitHub remote (non-blocking).- Also supports on-demand version checking with
_urdabash_version_check now
- Also supports on-demand version checking with
- Extension drop-in directory (
~/.config/urda.bash/extensions.d/).
Should work with bash 3.2 or higher.
clear- Hard reset the terminal screen.commitjoke- Random commit message fromwhatthecommit.com.cp- Copy with overwrite confirmation and verbose output.dadjoke- Random dad joke fromicanhazdadjoke.com.diff- Unified diff format, with color viacolordiffwhen available.epoch- Print current unix timestamp (seconds).headers- Fetch HTTP response headers only.ll- Long listing format (ls -hlF).moon- Current moon phase viawttr.in.mv- Move with overwrite confirmation and verbose output.path- PrintPATHentries, one per line.publicip- Print public IP address.serve- Start a quick HTTP server in the current directory (port 8000).shrug- Print the shrug emoticon.sudo- Preserves alias expansion when usingsudo.tableflip- Print the table flip emoticon.tableunflip- Print the table unflip emoticon.timestamp- Print current UTC timestamp in ISO 8601 format.weather- Terminal weather forecast viawttr.in.
bak- Back up a file with a
.bakextension.
- Back up a file with a
coinflip- Flip a coin.
get_uuid- Generate a random lowercase UUID (
uuidgen, Linux kernel, orpython3, whichever is present).
- Generate a random lowercase UUID (
mkcd- Create a directory and
cdinto it in one step.
- Create a directory and
psg- Search running processes by name. Filters out the
grepprocess itself.
- Search running processes by name. Filters out the
roll- Roll a die (d6 by default, or specify sides).
tempdir- Create and
cdinto a disposable temporary directory.
- Create and
unarc- Extract common archive formats by file extension.
update_brew(macOS only)- Runs
brew update,upgrade,autoremove,cleanup, anddoctorin sequence.
- Runs
These are internal helpers for urda.bash. You should not rely on them as a public API.
_prepend_path_once- Prepends a value to
${PATH}once, avoiding duplicates.
- Prepends a value to
_source_if_exists- Sources a file if it exists, skips otherwise.
_urdabash_help- Prints a quick reference of all aliases and functions.
_urdabash_info- Prints information about the current
urda.bashconfiguration.
- Prints information about the current
_urdabash_update- Self-updates
urda.bashby fetching the latest files from GitHub. Nogitrequired.
- Self-updates
_urdabash_version_check- Checks for a newer
urda.bashrelease on GitHub. Passnowfor an on-demand check.
- Checks for a newer
Bootstrap urda.bash on a new machine with a single command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/urda/urda.bash/master/install.sh)"urda.bash checks for new releases weekly in the background. If a newer version is found, a notice is printed on your next shell startup. To update, run:
_urdabash_updateYou can also force an on-demand version check:
_urdabash_version_check nowVersion check state is stored at ${XDG_STATE_HOME}/urda.bash/ (~/.local/state/urda.bash/):
last_check- Timestamp file used to determine when the next fetch is due.remote_version- Cached remote version string from the last successful fetch.
Drop *.sh files into ${XDG_CONFIG_HOME}/urda.bash/extensions.d/
(~/.config/urda.bash/extensions.d/) and they are sourced automatically at
shell startup, in sorted order, after the core urda.bash files and before
bash_secrets and bash_local. Use NN- prefixes to control load order:
10-bw-session.sh
20-work-tools.sh
The directory is optional and never touched by the updater. _urdabash_info
reports how many extensions loaded via URDABASH_LOADED_EXTENSIONS.
Sourcing an extension is running shell code in every interactive shell, with everything your user can do. Only place files you trust in this directory, and inspect anything you did not write yourself before your next shell starts.
If ~/.bash_local exists, it is sourced automatically after all other files. Use this file for machine-specific aliases, functions, or overrides that should survive upgrades.
If ~/.bash_secrets exists, it is sourced automatically. Use this file for API tokens, credentials, or any other private environment variables.
You can run a bare make or make help to display the help screen.
After you clone this repo, you can also run a quick diff that will compare your local bash files against the repo files:
make diffsThis will also run a make version-check.
make testBoot the managed files in a clean interactive shell against a temporary HOME:
make smokeSet SMOKE_BASH to select the shell under test:
make smoke SMOKE_BASH=/bin/bashWARNING! This is a DESTRUCTIVE operation and copies bash files from the project into your ${HOME}.
make copyJust run make version-check.
Before cutting a release, run the documentation parity checks:
make release-checkThis verifies that every alias and function agrees across the code, the _urdabash_help screen, and this README, that each list is alphabetized, and runs the version and MANIFEST checks.