Guide
This page is the master guide for my development environment. It contains short entries on all notable tools, commands, and other miscellaneous things that are worth documenting. As such, it's sort of a hodge podge, but I have attempted to keep it somewhat organized so that it remains useful.
Alias Cheat Sheet
Alias | Definition | Description |
---|---|---|
.. | cd .. |
Changes to the parent directory |
... | cd ../.. |
Changes to the grandparent directory |
- | ls - |
Changes to the previous directory |
brg | batgrep |
Short for batgrep |
cat | bat --paging=never |
Replaces cat with bat |
count | find . -type f \| wc -l |
Counts all files in the directory and any subdirectories |
ct | column -t |
Formats input data into columns |
cz | chezmoi |
Short for chezmoi |
cza | chezmoi apply |
Applies pending chezmoi changes |
czd | cd ~/.local/share/chezmoi |
Changes into the chezmoi source directory |
cze | chezmoi edit |
Edits a file tracked by chezmoi |
czr | chezmoi apply ~/.nixpkgs/darwin-configuration.nix darwin-update && exec $SHELL |
Applies the nix-darwin configuration and resets the shell environment |
g | git |
Short for git |
gcmsg | git commit -m |
Commits changes with a short message |
gd | git diff |
Shows current diff of working tree |
gst | git status |
Shows status of working tree |
left | ls -t -1 |
Sorts files by most recently modified |
ll | ls -la |
Shows all files and their properties |
lt | du -sh * \| sort -h |
Sorts files by their size |
mount | mount \| grep -E ^/dev \| column -t |
Makes the mount output easier to read |
now | date +"%T" |
Returns the current time |
ports | sudo lsof -iTCP -sTCP:LISTEN -n -P |
Shows all open ports |
today | date +"%d-%m-%Y" |
Returns the current date |
vi | vim |
Short for vim |
CLI Tools
asciinema
A CLI tool for recording terminal sessions. To start a recording:
Press ctrl+d
to stop the recording. You can save the cast locally or upload it
to the SaaS version. Unfortunately it doesn't provide a way to embed the output
in something like a Github README. I've found the best method for making it
portable is to convert the cast file to an SVG using svg-term-cli. This
can be checked in and then referenced directly in the README.c
ansible
A general-purpose automation tool for managing system lifecycles in a declarative and idempotent way.
autojump
A self-learning CLI tool for quickly navigating filesystems. Example:
The above works because I spend a large amount of time navigating to my ~/code
folder and dev
is the only child that partially matches. This will improve
overtime as the learning algorithm progresses.
awscli2
The official CLI tool for Amazon AWS.
bat
A fancy version of cat
. Performs syntax highlighting, pretty printing, line
numbering, etc. In my environment I have aliased cat
to bat
since by default
bat
will remove formatting when it detects a pipe so it should be a suitable
replacement.
These additional tools are also available:
batman
: Displays man pages usingbat
batgrep
: Likeripgrep
but passes output tobat
(aliased tobrg
)batdiff
: Likediff
but usesbat
batchwatch
: Watches a file usingbat
for outputprettybat
: Pretty prints a file usingbat
bitwarden-cli
The official CLI tool for Bitwarden. Provides programmatic access to a Bitwarden vault.
chezmoi
A dotfile manager. See the dedicated page for more information.
consul
An advanced network mesh geared at connecting microservices in a distributed environment.
fd
A sensible replacement for the find
CLI tool. It supports regular expressions,
glob patterns, and strict-text searching.
$ fd netfl
Software/python/imdb-ratings/netflix-details.py
$ fd passwd /etc
/etc/default/passwd
$ fd '^x.*rc$'
X11/xinit/xinitrc
fzf
A fuzzy-finder tool. Provides an interactive interface for performing a fuzzy
search across arbitrary data piped into the program. Incredibly useful when
combined with other tools like fd
and tldr
.
gh
The official Github CLI tool. Provides programmatic access to most features available on Github including the issues/PR lifecycles. Before it can be used it must be authenticated to a Github account:
Once authenticated, it's possible to begin interacting with repositories. Note
that gh
is context-aware based on the current repository.
google-cloud-sdk
The official Google Cloud CLI tool. Provides programmatic access to various Google Cloud services and a centralized interface for managing projects.
lastpass-cli
The official LastPass CLI tool. Provides programmatic access to a Vault for fetching secrets. Before using, requires authentication:
Once authenticated, you can begin querying the vault:
jq
A tool for manipulating and generating JSON on the command-line. Examples:
$ echo '{"id": 1, "name": "Cam"}' | jq '.id'
1
$ echo '{"nested": {"a": {"b": 42}}}' | jq '.nested.a.b'
42
$ echo '[0, 1, 1, 2, 3, 5, 8]' | jq '.[3]'
3
$ echo '[{"id": 1, "name": "Mario"}, {"id": 2, "name": "Luigi"}]' | jq '.[1].name'
"Luigi"
$ echo '{ "a": 1, "b": 2 }' | jq '{ a: .b, b: .a }'
{ "a": 2, "b": 1 }
$ echo '{ "a": 1, "b": 2 }' | jq 'keys'
[a, b]
$ echo '[1, 2, [3, 4]]' | jq 'flatten'
[1, 2, 3, 4]
navi
Provides access to cheat sheets from the command-line. This tool is a staple in
my environment as it provides a singular interface for storing rarely used CLI
invocations that are useful but hard to remember. Cheats are stored in
~/.cheats
directory in files that end with the .cheat
extension. They are
controlled by chezmoi
.
Creating a new cheat:
The above creates a cheat tagged wit git
and code
with a description of
"Revert last commit." When selected, the command it will return is
git reset HEAD~
.
Accessing cheats is done by either pressing ctrl + g
or executing navi
.
packer
A tool for generating immutable images. Packer provides a syntax for defining immutable operating system images which can then be readily deployed through various services like AWS/GCP/Azure. These are often referred to as "golden images."
ripgrep
A sensible replacement for grep
. It's faster, provides support for regular
expressions, and provides more useful context then it's counterpart.
For source code files, it's recommended to use batgrep
:
It provides more context around matche as well as syntax highlighting.
terraform
A tool for automating complex deployments. Provides a syntax for defining the state of a complex system and then supports interacting with that state by creating it, modifying it, and destroying it. Supports the IaC model.
tldr
A tool for generating short summaries of various popular CLI tools. A great
alternative to --help
or man
as it often succinctly demonstrates what a tool
is and how to quickly get started with it.
vault
A secrets backend for managing various secrets. Provides a secret store for arbitrary secrets, encryption on demand, dynamic credentials, certificate generation, etc.