Using the Terminal — Bash Aliases
Some practical advice about using and getting used to the Linux terminal
I’m not a system administrator by any means, but I’ve been a Linux user for almost 20 years, and that has transformed me into a frequent user of the command line. Looking back, there is one piece of advice I would give to my younger self the first time I sat down at a terminal and got trapped in vim. It’s this: track the commands you use, and save them in a .bash_aliases
file. That simple piece of advice has made me much more effective over the years, and the benefits compound.
Note: this post assumes some familiarity with the Linux terminal. It is not an introduction to the .bashrc file, for that, see here. If you came here looking for a post about AI, you’re probably dissappointed. However, this is a post about the boring nitty-gritty of actually doing AI, so you might find it useful even if it’s boring. I recommend this content to any programmer who doesn’t already know what I’m going to say.
Aliases — What’s the Point?
The primary benefit of aliases is straightforward: they make it easier to remember how to do stuff. Instead of recalling complex syntax with numerous flags and options, you create intuitive shortcuts that map to your mental model of what the command should do.
I’m going to walk through examples from my own .bash_aliases
file, and point out why they’re useful. I recommend you put your own aliases file up on GitHub, so you can easily save it between computers. My own bashrc file just says:
source ~/Dev/utils/bash/.bashrc
Basic Stuff
alias godev='cd ~/Dev' # Quick directory jumping
alias gohome='cd ~'
alias godown='cd ~/Downloads'
I keep all of my programming projects in the ~/Dev
directory, but it is mildly inconvenient to type out cd ~/Dev
, so the alias saves some keystrokes. The godown
alias is there because I kept forgetting whether the directory was named “Downloads” or “Download”.
Git
Version control commands are notoriously verbose.
alias gs="git status && git diff --stat" # Elaborate status
alias ga="git add -A" # Stage all changes
alias commit="git commit -am" # Commit with message
alias undocommit="git reset --soft HEAD~1" # Undo last commit
alias gitmain="git checkout main" # Switch to main branch
alias gitgood='git tag -a good -m "Currently in a good state"' # Tag good state
Sure, the name “gitgood
” is funny, but it’s also helpful! I don’t really have any idea why the git tag
command wants the -a
flag before the tag name, and now I never need to remember it. Similarly, why does the gs command include the --stat
flag? In this case, the reason is that I experimented with it and this is what I thought was pretty.
Python Stuff
I often need to run Python on the command line, and
alias pythonheretoo='export PYTHONPATH=$PYTHONPATH:.' # Add current dir to path
alias venvo='source venv/bin/activate' # Activate virtual env
alias acto='pythonheretoo && venvo' # Do both at once
alias py='python' # Shorter python
source ~/Dev/utils/bash/newpydir.sh # Run custom setup script
The acto
command combines two common operations into a single memorable command, reducing a multi-step process to four keystrokes.
The last line runs this script, which does some setup to create a new directory with its own virtual environment.
Your specific uses will likely vary, and that’s the point. Figure out what commands you’re running often, and immortalize them with an alias!
Whole Little Programs
Sometimes, you wish you could do something on the command line that isn’t easy with the built-in features. In that case, you can ask an LLM like Claude to write you a bash script to do whatever you want. Then, just copy it into your .bashrc
file, or create a new script and source it. Here’s an example of a nice little utility that shows me the local files.
If you ever do something complicated on the command line, and you think you’re likely to do it again, save it as a script!
Bring Joy into the Terminal
Who says the command line has to be serious? Some of my aliases exist primarily to make terminal work more fun:
# Grow an ASCII bonsai tree
alias growtree='cbonsai -l'
# Spanish fortune with English translation
fortuna() {
spanish_fortune=$(fortune /usr/share/games/fortunes/es)
echo "$spanish_fortune"
spanish_fortune=$(echo "$spanish_fortune" | tr '\n' ' ')
trans es:en --brief "$spanish_fortune"
}
# Get news summaries
alias thenews='http https://www.bloomberg.com/ | html2markdown | cat | aichat "Summarize the headlines for today. Focus on finance and science. Include links."'
fortuna
These commands transform the terminal from a purely utilitarian tool into something that can surprise and delight.
The fortuna
function provides me a little Spanish practice. By calling fortuna
at the bottom of the .bashrc
file, I get a little bilingual message, like this:
No hay bien que dure, ni mal que no se acabe. There is not good that it lasts, or bad that it does not end.
Short Utilities
alias pingo='ping 8.8.8.8' # Quick connectivity check to Google DNS
Is the internet connection down, or is it just me? When my connection seems flaky, typing pingo
is faster and easier to remember than the full command.
alias e="micro" # Launch micro editor
Sure, the single-letter “e” is only marginally shorter than the editor name, “micro”. The real reason I do this is because I switched from ne
to nano
to micro
, and I wanted muscle memory for a single command. Maybe one day I’ll alias e=”neovim”
, like a real programmer.
AIs
Did you know, you can use LLMs on the command line? Why would you want to do that, I hear you asking, when claude.com is minimalist and functional? Well, the defensible reason is that you can easily script them, but the truth is that sometimes I just don’t want to alt-tab.
alias aichatter='aichat -s' # Start AI in chatty mode
alias aiderchat='aider --chat-mode ask' # Open aider in chat mode
alias aiderm='aider --message' # Send a message to aider
The first command links to aichat, and the last links to aider, which is an amazing tool. If you’re a command-line-using programmer in the year 2025, you should absolutely check out aider, it’s amazing. If you live in the future, you probably have Custom Drawing Tools
Terminal work doesn’t have to be all text. These aliases add visual elements to the command line:
alias drawurl='drawurl_func() { curl -s "$1" | catimg -; }; drawurl_func' # Display image from URL
alias drawtext='bash ~/Dev/utils/bash/drawtext.sh' # Convert text to ASCII art
The drawurl
function fetches an image from a URL and displays it directly in the terminal, while drawtext
transforms plain text into eye-catching ASCII art. These tools add a touch of creativity to an otherwise utilitarian environment.better stuff.
Art
If you’re using images in any serious capacity, you should use a browser or Photoshop or something. However, I bring you the drawtext utility, to make ascii art in the terminal. It’s not very useful, but it does amuse me.
# Display random art from collection
alias art='find ~/Pictures/Art -type f -name "*.jpg" -o -name "*.png" | shuf -n 1 | xargs -I {} catimg -w 120 {}'
alias drawurl='drawurl_func() { curl -s "$1" | catimg -; }; drawurl_func' # Display image from URL
alias drawtext='bash ~/Dev/utils/bash/drawtext.sh' # Convert text to ASCII art
Aliases for Aliases: Meta-Management
A well-designed alias system includes tools for its own maintenance:
alias bashupdate='source ~/.bashrc'
alias bashedit='micro ~/Dev/utils/bash/.bash_aliases && bashupdate'
alias bashrcedit='micro ~/Dev/utils/bash/.bashrc && bashupdate'
Now you can simply type bashedit
, update your aliases file, and then it will automatically reload! IMO this one should be standard.
Don’t Expose your Secrets!
I include this command:
source ~/Dev/private_keys.sh
That file contains all of my private keys. Importantly, it is not on source control.
Creating Your Own
If you’re inspired to develop your own alias system, here are some principles to guide you:
Start with your most frequent commands: Analyze your history to identify repetitive patterns.
history | awk '{print $2}' | sort | uniq -c | sort -nr | head -20
Create consistent naming patterns: Group related commands with common prefixes (go
for navigation, git
for version control). Prefer shorter names based on that.
If you have workflow-specific commannds, consider creating a section for that. For example, maybe there’s one long command you need to run tests with every time you git push. You will save yourself time and headache by creating an alias.
For example, at my previous job, I had alias controller="sudo tailscale up; source ~/controller
, which isn’t something I need now, but at the time I needed to run it many times a day, so having a short command was easily worth it.
Use a Delightful Prompt
Your bash prompt is perhaps the most visible element of your terminal experience—you see it before every command you type. A good prompt can be informative and add personality to your environment.
Here’s an example of what my terminal looks like. I put in lots of colors, because I need constant stimulation. I also include random green emojis to let me know that the commands are succeeding (or random red emojis if they fail). Again, because I need constant amusement in order to pay attention.
Why customize your Prompt?
Information density: Display git branch, exit status, time, and directory at a glance
Visual differentiation: Quickly distinguish between different environments (production vs. development)
Mood enhancement: Add color and even emoji to make terminal work more pleasant
Here’s some of what I got:
# From .bash_ps1
export PS1='\[$(color_bg_blue)\]\t\[$(color_reset)\] $(command_status) '
PS1+='\[$(color_bg_blue)\]$(virtual_env)\[$(color_bg_cyan)\] $(trim_path) '
PS1+='\[$(color_bg_blue)\]$(number_of_files)f$(number_of_directories)d'
PS1+='\[$(color_bg_green)\]$(parse_git_branch)'
PS1+='\[$(color_bg_yellow)\]$(git_status)'
PS1+='\[$(color_reset)\] $ '
This prompt shows: - Current time with blue background - Command success/failure with random emoji (🌱 for success, 🔥 for failure) - Active Python virtual environment - Current directory (with smart path shortening) - File and directory counts in current location - Git branch and status information - All with distinct color coding for quick visual parsing.
Caution!: The PS1 format is notoriously arcane and error-prone. It is some bullshit dreamed up by hackers in the 1970s and it has escaped modernization to this day. For example, if you want your text to be light blue, you have to type \e[0;34m
. Why does that mean light blue text? Because fuck you, that’s why!
Rather than writing PS1 code by hand, I strongly recommend telling an LLM what you want, and copying its output without looking at it straight into your .bashrc
file. If it ever behaves badly, ask the LLM to fix it.
Conclusion
TL;DR: Use the .bash_aliases
file to easily remember all the stuff you do on the command line. Give everything a ridiculously silly name so that you will remember it.
Let your aliases file become a living document that evolves with your needs and preferences. Commands you use frequently get shorter names, complex operations get simplified, and your terminal becomes increasingly tailored to the way you work.
Here are Claude’s top suggestions for ridiculous alias names:
alias wtf='git blame' # Find out who to blame
alias yeet="rm -rf" # Delete files/folders aggressively
alias scream="echo" # Print to terminal
alias gtfo="cd ~" # Go to home directory
alias yolo='git commit -m "YOLO"; git push -u origin master'