5 Ways to Trick Out Your Terminal

Your terminal prompt is the first thing you see when you open a command line. For most people, it is a dull green or white line with a dollar sign. But it does not have to be that way. With a few tweaks, you can turn that boring prompt into a dashboard that shows command duration, success or failure status, and even a timestamp. This kind of terminal prompt customization not only makes your shell look more polished but also helps you work faster. You can spot failed commands instantly, track how long tasks take, and feel a little more at home in your terminal.

terminal prompt customization

In this article, we will walk through five practical ways to trick out your terminal. These are based on real-world techniques used by experienced users who have spent years bending their shells to their will. Whether you use fish, bash, or zsh, you can apply these ideas to your own setup. Let us dive in.

1. Embed Command Timing and Status Symbols into Your Prompt

One of the most useful upgrades you can make is to show how long each command took to run. The fish shell makes this especially easy with its CMD_DURATION variable. When you finish a command, fish stores the duration in milliseconds. You can then convert that into hours, minutes, seconds, and even microseconds. This lets you see at a glance whether a script ran in 2 seconds or 2 minutes.

Here is a typical fish prompt function that does exactly that:

function fish_prompt --description 'Write out the prompt'
 set -l last_status $status
 set -l cmd_duration ""
 if set -q CMD_DURATION
 set -l duration_us (math "$CMD_DURATION * 1000")
 set -l us (math "$duration_us % 1000")
 set -l ms (math "floor($duration_us / 1000) % 1000")
 set -l s (math "floor($duration_us / 1000000) % 60")
 set -l m (math "floor($duration_us / 60000000) % 60")
 set -l h (math "floor($duration_us / 3600000000)")
 #. formatting logic.
 end
 #. rest of prompt.
end

This code breaks the duration into human-readable units. If a command runs for more than an hour, you see something like (1h23m). If it finishes in under a second, you might see (456ms) or even (789us). That level of detail helps you notice performance regressions. The prompt also shows a checkmark (✓) when the exit status is zero and a cross (✗) when it is not. This is a prime example of terminal prompt customization that gives you immediate feedback.

What if you use bash or zsh?

You can achieve similar timing in bash using the PROMPT_COMMAND variable. Store the current time before each command, then calculate the difference after. In zsh, you can use the preexec and precmd hooks. There are also tools like starship that work across all shells and include built-in timing.

2. Add Color with GRC and ANSI Escape Codes

Color in the terminal is not just cosmetic. It can signal success, failure, or context at a glance. One tool that makes this easy is GRC, the Generic Colorizer. It adds syntax highlighting and coloring to commands like ls, df, du, ping, and traceroute without any extra configuration.

To use GRC, you install it (available in most package managers) and then define aliases to replace the original commands with their colorized versions. For example:

alias ls='grc ls --color=auto'
alias df='grc df -h'
alias du='grc du -h'
alias ping='grc ping'
alias traceroute='grc traceroute'

These aliases live in .bash_aliases (or .config/fish/config.fish for fish users). Once set, every time you run ls, you get directories in blue, executables in green, and symlinks in cyan. It makes scanning directory listings much faster.

For your prompt itself, you can use ANSI escape codes or the set_color command in fish. In the example prompt above, colors like dark_gray, blue, red, green, and purple are defined. The timestamp appears in dark gray, the exit status in green or red, and the username in purple. This terminal prompt customization turns a monochrome line into a rich information display.

A word of caution about too much color

Some people argue that heavy syntax highlighting encourages skimming and reduces deep reading. That may be true for prose, but for a terminal prompt, color serves as a rapid indicator. A red cross stands out instantly among a sea of green checkmarks. If you find the colors distracting, you can tone them down or use a single accent color. The key is to use color deliberately, not randomly.

3. Choose the Right Terminal Emulator for Your Workflow

The terminal program you run matters more than you might think. While MacOS’s Terminal.app works fine, it lacks features like true color support, GPU-accelerated rendering, and advanced window management. Many developers switch to alternatives like iTerm2, Alacritty, or Ghostty.

iTerm2, for example, offers built-in tmux integration, split panes, and a robust search feature. Alacritty focuses on speed and simplicity, using the GPU for rendering. Ghostty is a newer option that aims for a balance of performance and usability. Each has its strengths, and the best choice depends on your needs.

But here is the secret: you do not need to switch to a fancy emulator to enjoy terminal prompt customization. Even the default Terminal.app supports 256 colors and basic ANSI escape codes. The prompt customizations we covered work everywhere. However, if you want to display over 16 million colors (true color) or use ligatures in fonts, you will need a modern emulator that supports those features.

Considerations for cross-platform consistency

If you work on both macOS and Linux, you might want a consistent look across machines. One approach is to use the same shell on both, like fish or zsh, and sync your dotfiles via a Git repository. Tools like stow or chezmoi help manage these files. That way, your carefully crafted prompt and aliases follow you everywhere.

4. Create Aliases for Human-Readable Output

Many command-line tools default to raw numbers that are hard to parse. For instance, df shows disk space in kilobytes, and du shows file sizes in bytes. Adding the -h flag (human-readable) converts those to megabytes, gigabytes, or terabytes. It is a small change that saves mental math.

You may also enjoy reading: 7 Next Year iPhone Pro Models Design Leaks Revealed.

You can make this the default by creating aliases:

alias df='df -h'
alias du='du -h'
alias free='free -h'

In fish, you can define these in your config.fish file. In bash, put them in .bash_aliases or .bashrc. Once set, you never have to type -h again. This is a form of terminal prompt customization that extends beyond the prompt itself to every command you run.

Combining aliases with GRC

You can even chain GRC with the -h flag. For example:

alias df='grc df -h'
alias du='grc du -h'

This gives you both colorized output and human-readable numbers. It is a small investment of time that pays off every single day.

5. Build a Cross-Shell Prompt Function from Scratch

The most rewarding way to trick out your terminal is to write your own prompt function. You do not need to be a developer. As the raw context shows, a few hours of searching through examples can yield a working solution. The fish prompt we saw earlier is a perfect template. It saves the last exit status, calculates duration, formats it, and prints a timestamp along with status symbols.

Here is the full function again, rewritten for clarity:

function fish_prompt
 set -l last_status $status
 set -l cmd_duration ""
 if set -q CMD_DURATION
 set -l duration_us (math "$CMD_DURATION * 1000")
 set -l us (math "$duration_us % 1000")
 set -l ms (math "floor($duration_us / 1000) % 1000")
 set -l s (math "floor($duration_us / 1000000) % 60")
 set -l m (math "floor($duration_us / 60000000) % 60")
 set -l h (math "floor($duration_us / 3600000000)")
 if test $h -gt 0
 set cmd_duration (string join '' "(" $h "h" $m "m)")
 else if test $m -gt 0
 set cmd_duration (string join '' "(" $m "m" $s "s)")
 else if test $s -ge 10
 set -l fraction (math "floor($ms / 100)")
 set cmd_duration (string join '' "(" $s "." $fraction "s)")
 else if test $s -gt 0
 set cmd_duration (string join '' "(" $s "." (printf "%03d" $ms) "s)")
 else if test $ms -ge 100
 set cmd_duration (string join '' "(" $ms "ms)")
 else if test $ms -gt 0
 set -l fraction (math "floor($us / 100)")
 set cmd_duration (string join '' "(" $ms "." $fraction "ms)")
 else
 set cmd_duration (string join '' "(" $us "us)")
 end
 end
 set -l checkmark "✓"
 set -l cross "✗"
 set -l normal (set_color normal)
 set -l dark_gray (set_color 555555)
 set -l blue (set_color -o blue)
 set -l red (set_color red)
 set -l green (set_color green)
 set -l purple (set_color -o purple)
 echo
 echo -n -s $dark_gray "["(date +%T)"] $last_status "
 if test $last_status -eq 0
 echo -n -s $green $checkmark
 else
 echo -n -s $red $cross
 end
 echo -n -s $dark_gray " $cmd_duration"
 echo
 set -l host_color $purple
 echo -n -s $host_color $USER "@" (prompt_hostname) $normal ":" $blue (prompt_pwd) $normal " \$ "
end

This function is a complete example of terminal prompt customization. It shows the time in brackets, the exit status number, a colored checkmark or cross, the command duration, and then the username, hostname, and current directory on a new line. You can tweak the colors, symbols, and format to match your taste.

Where to find pre-built themes

If writing your own function feels daunting, there are many pre-built prompt themes. Tools like oh-my-zsh, oh-my-fish, and starship offer dozens of themes that include status symbols and duration. You can install one and then customize it to your liking. Starship, in particular, works across all shells and is configured with a simple TOML file.

No matter which route you take, the goal is the same: make your terminal work for you, not against you. The messy timer conversion in the fish function above is a perfect example of how even non-developers can bend their terminal to their will. A few lines of code, a handful of colors, and some Unicode symbols can transform a dull prompt into a powerful dashboard.

So go ahead and open your shell configuration file. Start with one change — maybe add a timestamp or a checkmark. Then experiment with duration. Before long, you will have a terminal that feels uniquely yours, and you will wonder how you ever worked without it.

Add Comment