Functions
General Functions
Section titled “General Functions”sudo_if_needed
Section titled “sudo_if_needed”sudo_if_needed checks if the file requires superuser permissions and returns sudo if needed
Usage: sudo_if_needed <file>
die echoes the first argument as an error message and exits the shell
Usage: die "Error: Something went wrong."
Create a new directory and enter it
Usage: mkd <dirname>
Create a .tar.gz archive, using zopfli, pigz or gzip for compression
Usage: Usage: targz [--name custom_name] <path to file or directory>...
server
Section titled “server”If a caddy server is installed then that is preferred over Python.
Start an HTTP server from a directory, optionally specifying the port
Usage: server [path] [port]
Normalize open across Linux, macOS, and Windows.
This is needed to make the o function (see below) cross-platform.
o with no arguments opens the current directory, otherwise opens the given
location
Usage: o, o ., o ~/, o ./myproject, etc.
ow opens a web URL in the browser. It accepts http(s)://, ssh://, git://
and git@host:user/repo style URLs, or the name of a git remote. With no
arguments it opens the current repository’s origin remote (or the first remote).
Git url.<base>.insteadOf aliases and SSH Host aliases from ~/.ssh/config
are resolved to their real host.
Usage: ow, ow upstream, ow https://example.com, ow git@github.com:user/repo.git
topcu shows the cuda usage and GPU information using the sysmon.py script.
Usage: topcu
tre is a shorthand for tree with hidden files and color enabled, ignoring
the .git directory, listing directories first. The output gets piped into
less with options to preserve color and line numbers, unless the output is
small enough for one screen.
Usage: tre <directory>
ginit initailises a git repository and makes an initial commit
Usage: ginit or ginit "Initial commit"
echoerr
Section titled “echoerr”echoerr echoes the first argument to stderr. Useful for printing errors.
Usage: echoerr "Error: Something went wrong."
dlc deletes all lines that start with the specified comment symbol
Usage: dlc "<file>" "<comment_symbol>"
Converts all file names in the current directory to some UUID names leaving the extension intact
Usage: uuidf
snapc cleans up old snap versions
Usage: sudo snapc
debi installs a .deb file using apt install
Usage: debi <file.deb>
lsu lists all USB devices connected to the system
Usage: lsu
wrap_text
Section titled “wrap_text”wrap_text wraps text to a specified width and indentation
Usage: wrap_text "<text>" [width] [indent]
lsinotify lists inotify watches for each process and displays them in a formatted table
Usage: lsinotify
count counts files and directories for each path given. For a directory it prints the totals; for a file it prints its line count. Defaults to the current directory.
Usage: count or count <directory> or count <file> or count *.js
sup updates the system by first updating package indices, then listing upgradable packages, and finally performing the upgrade.
Usage: sup
WSL-Specific Functions
Section titled “WSL-Specific Functions”pww similar to pw but from wsl
Usage: pww
ppw similar to pp but from wsl
Usage: ppw
File and Directory Compression Functions
Section titled “File and Directory Compression Functions”sd securely deletes one or more files or directories by overwriting them before deletion
Usage: sd <file or directory> [file2] [file3] ... [-f] [-n <passes>]
Options:
-f, --force Force deletion without confirmation prompt
-n, --passes <num> Number of overwrite passes (default: 5)
7zc creates a 7Zip archive using the LZMA2 algorithm
Usage: 7zc <file or directory> [file2] [dir2] ... [-n <name>] [-p] [-s <size>] [-f]
Options:
-n, --name <name> Archive name (without extension). Required when archiving multiple items; defaults to the single item’s basename otherwise.
-f, --force Skip the confirmation prompt.
-p Prompt for password to encrypt the archive
-s <size> Split archive into parts of specified size. Supports b (bytes)/k (kilobytes)/m (megabytes)/g (gigabytes) units (e.g., -s 500m, -s 1g, -s 2048k). Defaults to MB if no unit specified.
7zip creates a .zip archive using 7-Zip’s Deflate method (maximum portability).
Usage: 7zip <file or directory> [file2] [dir2] ... [-n <name>] [-p] [-s <size>] [-f]
Options:
-n, --name <name> Archive name (without extension). Required when archiving multiple items; defaults to the single item’s basename otherwise.
-f, --force Skip the confirmation prompt.
-p Prompt for password to encrypt the archive (AES-256).
-s <size> Split archive into parts of specified size. Supports b (bytes)/k (kilobytes)/m (megabytes)/g (gigabytes) units (e.g., -s 500m, -s 1g, -s 2048k). Defaults to MB if no unit specified.
7zx extracts one or more archives, each to a directory with the same name as the archive.
When extracting multiple password-protected archives, the password that worked for the previous archive is tried first; you are only prompted if it fails.
Supported formats: zip, rar, 7z, tar, tar.gz, tgz, tar.bz2, tbz2, tar.xz, txz, gz, bz2, xz
Usage: 7zx <filename>.7z [file2] ... or 7zx <filename>.7z.001 (for multi-part archives)
zc compresses one or more files/directories into a single zstd-compressed tar archive
Usage: zc <file or directory> [file2] [dir2] ... [-n <name>] [-f]
Options:
-n, --name <name> Archive name (without extension). Required when archiving multiple items; defaults to the single item’s basename otherwise.
-f, --force Skip the confirmation prompt.
zx extracts a zstd compressed tar file
Usage: zx <file.tar.zst>
tgc compresses one or more files/directories into a single gzip-compressed tar archive
Usage: tgc <file or directory> [file2] [dir2] ... [-n <name>] [-f]
Options:
-n, --name <name> Archive name (without extension). Required when archiving multiple items; defaults to the single item’s basename otherwise.
-f, --force Skip the confirmation prompt.
tgx extracts a gzip compressed tar file
Usage: tgx <file.tar.gz>
Git Related Functions
Section titled “Git Related Functions”gclone
Section titled “gclone”gclone clones a git repository and cd’s into it
Usage: gclone <git_url>
gsubd removed the current Git submodule and its entry in .gitmodules
Usage: gsubd <submodule_path>
gclean
Section titled “gclean”gclean removes all untracked files, including ignored files and directories
Usage: gclean
gcl Generates a changelog from the commit history
Usage: gcl
gbranch
Section titled “gbranch”gbranch creates a new git branch and switches to it. Adds a “-” if spaces are present in the branch name.
Usage: gbranch <branch_name>
Dotfiles Related Functions
Section titled “Dotfiles Related Functions”dot prints help for the dotfiles and can be used to run the dotfiles functions
Usage: dot or dot <command>
dotu updates the dotfiles to the latest main branch
Usage: dotu
dotub updates binary files only to its latest version from GitHub releases.
Usage: dotub or dotub --dry-run to see what would be updated without actually updating
dotls lists all the aliases and functions in the dotfiles with their descriptions
Usage: dotls
