Linux flavored BASH functions for casual CLI
A practical Bash utility pack for Ubuntu 24.04 that replaces macOS specific behavior with Linux ready commands. It includes fast JSON inspectors, note and TODO search, clipboard and text shaping helpers, date and time converters, simple networking math, file dumpers for reviews, and small quality of life wrappers for Git and Terraform. Sensible auto detection picks Wayland or X11 clipboards, with clear fallbacks. Drop the script in your home directory, source it from .bashrc, and use the grouped functions as focused, composable tools in everyday workflows.
A compact Bash function and alias library tuned for Ubuntu 24.04. It replaces macOS specific bits with Linux friendly commands and adds sensible fallbacks. Utilities cover JSON viewing, note searching, clipboard text shaping, time and date helpers, simple networking math, project file dumping, and small quality of life wrappers for Git and Terraform.
Functions with leading underscores (e.g., _function_name) are internal helper functions called by other functions and should not be invoked directly by users. Functions without leading underscores are safe for direct user invocation.
Core: bash, curl, grep, sed, awk, find, ls, date, printf
Recommended: jq, uuidgen (util-linux), wl-clipboard or xclip or xsel, ccrypt, coreutils, neofetch
Optional: terraform, git, base32
MyFuncs includes an automatic dependency installer that detects your Linux distribution and package manager:
myfuncs_install_depsThis will:
- Detect your package manager (apt, dnf, yum, pacman, brew, etc.)
- Check for required dependencies
- Install missing packages automatically
- Provide clear feedback on installation status
Run this after initial setup to ensure all features work properly.
Install suggestions:
sudo apt update
sudo apt install -y jq uuid-runtime xclip ccrypt coreutils git curl
# Wayland clipboard (if on Wayland):
sudo apt install -y wl-clipboardClone the repository to your preferred location, then run the automated installer:
# Clone the repository
git clone https://github.com/jorgedlt/myfuncs.git ~/git/myfuncs # Or any directory you prefer
# Navigate to the cloned directory
cd ~/git/myfuncs
# Run the installer (this adds a source line to ~/.bashrc pointing to the cloned .myfuncs)
source .myfuncs && myfuncs_install
# Optional: Install dependencies
myfuncs_install_depsThat's it! The installer will:
- Detect the location of
.myfuncsin the cloned repository - Add a
sourceline to your~/.bashrcpointing to that exact path - Source the functions immediately for the current session
- Leave the source code in the cloned directory (no copying to home)
Now, whenever you open a new terminal, MyFuncs functions will be automatically available. If you update the repository (e.g., via git pull), the changes will be reflected immediately without re-installing.
If you prefer manual setup:
# After cloning and cd'ing to the repo
echo 'source "$(pwd)/.myfuncs"' >> ~/.bashrc
source ~/.bashrc# JSON
jcat file.json # pretty print JSON
jqkeys < file.json # show JSON keys
jqcheck file.json # validate JSON
jqpaths < file.json # show JSON paths
jqjoke # fetch sample JSON
# Notes
busca "kafka" # search notes
whattodo # TODO density by file
cleartodo 2024-10-01 30 # mark TODO to SKIP in date range
# Clipboard and shaping
clip 72 # wrap clipboard text at 72
ones # collapse multiple spaces
moos '_' ' ' # replace char in clipboard content
# Time, date, conversions
epochnow
e2h 1732646400
h2e "Jan 1 2025"
utc2local 2025-01-01T00:00:00
# Networking
netcalc 192.168.1.0 255.255.255.0
pubip
whereip 8.8.8.8
# Files and git
splat "*.md" # print files with headers
splooge . # recursive print with extension filter file
gitdiff README.md
look4this "*.tf" module # search text in matching files
# Terraform (if installed)
tfchk
# Help system
funchelp # Show all available functions
funchelp json # Show JSON function help
funchelp jqcheck # Show help for specific function
# Installation and dependency management
myfuncs_install # Configure MyFuncs in ~/.bashrc (sources from repo location)
myfuncs_install_deps # Check and install all required dependenciesjcat,jqkeys,jqcheck,jqpaths,jqjokePretty print JSON, explore JSON structures, validate JSON files, show JSON paths, and fetch a simple sample JSON payload for testing.
busca,whattodo,cleartodo,bang,findbangSearch personal notes, summarize TODO density, bulk mark TODO as SKIP in a time window, and generate quick anchors.
pubip,whereip <ip>,whoip,netcalc <ip> <mask>Show your public IP, basic IP geolocation, reference list lookups, and mask math.
splat,splooge,gitdiff <file>Print files with headers for review, recursively print while honoring~/.splooge.filter, and diff a file against HEAD.
clip,clop,clpcry,nocry,ones,moos,txtcln,mkhead,mkbody,mkgrid,lineup,spaceout,numcat,coldwar,letonly,fold64,colxWork well on Wayland or X11.clpcryandnocrydepend onccrypt.mkheadandmkbodyhelp build Markdown tables fast.
epochnow,e2h,h2e,utc2local,inthepast,inthefutureThin wrappers overdatefor quick conversions.
hl,hg,tnb,dropone,uc,lc,getwin,tabname- Prompts:
normalprompt,gitprompt,exitprompt, plusgithelp,prompthelp - Help:
funchelp [topic]- Comprehensive help system - Installation:
myfuncs_install,myfuncs_install_deps- Configure sourcing from repo and install dependencies
_tffunauto-loads aliases ifterraformexists:tfini,tfval,tffmt,tfpln,tfapl,tfdes,tfshw,tflst,tfout,tfref,tfimp
-
~/.splooge.filterdefines filename patterns to exclude per line, for example:.json .log .tmp node_modules
- Wayland desktops: install
wl-clipboardand you get instant clipboard support. - X11 sessions: install
xcliporxsel. - Set your timezone in the environment if needed:
export TZ=America/New_York. - Keep
jqandyqup to date for predictable parsing.
Use under your preferred internal policy. Review third party tool licenses you install.
A practical Bash utility pack for Ubuntu 24.04 that replaces macOS specific behavior with Linux ready commands. It includes fast JSON inspectors, note and TODO search, clipboard and text shaping helpers, date and time converters, simple networking math, file dumpers for reviews, and small quality of life wrappers for Git and Terraform. Sensible auto detection picks Wayland or X11 clipboards, with clear fallbacks. Drop the script in your home directory, source it from .bashrc, and use the grouped functions as focused, composable tools in everyday workflows.