Introduction Link to heading
This will be a short post, I plan to follow up on it as I discover more CLI tools and aliases that help my day-to-day workflow.
Here’s a list of my most commonly used aliases, many of which are for tools I’m digging currently, and context on the aliases.
Aliases and their tools Link to heading
Git Aliases Link to heading
Git is a key part of dev workflows, and we type these commands a lot. Why not save some time and keystrokes?
- ghdif:
alias ghdif='git diff ^HEAD'
– this is a command I found myself running a lot, I should add moregit
commands to aliases and I’ve been looking into the GitHub CLI as well for streamlining UI-based GitHub specific workflows as well. - gs:
alias gs='git status'
, ga:alias ga='git add'
, and gc:alias gc='git commit -m'
are similar time savers.
Other services Link to heading
Some common operations or commands just get tiring to type…
-
sts:
alias sts="aws sts get-caller-identity"
– I run this one a LOT working in different AWS environments and profiles, needing to pull account numbers and more. -
k:
alias k='kubectl'
– this one is standard for working with k8s, I don’t know how much time it’s saved me incrementally over the years. -
tf:
alias tf='terraform'
– ’terraform’ is pretty long to type over and over again, it’s no ‘k’ but ’tf’ saves my hands some strain.
The old is new again(standard commands improved) Link to heading
Everyone knows ls
, cat
and cd
, but what if I told you that you could do better?
-
ls:
alias ls='eza --long --all --no-permissions --no-filesize --no-user --no-time --git'
– this aliasesls
with eza, a more descriptive and fancy alternative. -
cat:
alias cat='bat --paging never --theme DarkNeon --style plain'
– here,cat
becomes bat, a “cat clone with wings” as the repo describes it. Much like myls
alias, improving on an existing command with a more modern version. -
cd:
eval "$(zoxide init --cmd cd zsh)"
– not exactly an alias, but an initialization of zoxide, a smartcd
alternative/improvement. Working with several repos with many directories in rapid succession, zoxide’s ability to jump to frequently used directories is a game-changer.
Some fun(and powerful) aliases with modern tooling Link to heading
Witness the beauty of enhanced fuzzy finding and, well.
-
fzf:
alias fzf='fzf --preview "bat --style numbers --color always {}"'
– I could write a whole post about fzf, a fuzzy finder that filters lists with a fuzzy matching algorithm that gives great results. I mostly use it for going through the filesystem. Using this withopen
,cd
(aliased tozoxide
) or other commands really gets powerful fast. This alias usesbat
to preview the results of the fuzzy listing for easy reading. -
fu:
alias fu=fuck
– this is a short alias for thefuck, a super fun and helpful command which corrects previous incorrect terminal commands. Very useful to swiftly remedy typos or get that command right.
Lastly, adding aliases quick and with output Link to heading
Getting these all ready and sourced can be a pain, how about we ease that?
- addzsh:
alias addzsh='tee -a ~/.zshrc && source ~/.zshrc'
– this is meant to be run asecho "alias <alias>=<aliased_command>" | addzsh
, this outputs the alias to be added to~/.zshrc
, adds it and sources the new config. You could prepend acp ~/.zshrc ~/.zshrc.bak
to this if you wanted to be more cautious as well!
Conclusion Link to heading
I hope these aliases and tools spark your interest and provide a jumping-off point for streamlining and improving your workflows! Reach out on LinkedIn if you have any questions or comments, I’m still implementing comments and an RSS feed on this preliminary new personal site. Thanks for reading!