A simple fish prompt for DevOps work

enzu.ru
1 min readSep 9, 2019

--

“Finally, a command line shell for the 90s”

The two primary things that I need to know when I engineer modern DevOps pipelines for companies are my:

  • AWS profile
  • Kubernetes context

These two determine which environments and clusters will be affected by my terraform, kubectl, and helm commands.

I use the fish shell which offers a fresh approach to the command line with powerful autosuggestions. I installed an Oh My Fish plugin which allows me to change AWS profiles very easily: https://github.com/oh-my-fish/plugin-aws

I then customize my prompt by modifying the .config/fish/functions/fish_prompt.fish file to look like this:

function fish_prompt
set awsenv (aws profile)
set kubenv (kubectl config current-context)
set wpath (pwd)
echo "[$awsenv][$kubenv][$wpath]> "
end

This gives me a prompt that looks like:

[prod-aws][kube.company.org][/home/enzuru/src]

--

--

enzu.ru
enzu.ru

Written by enzu.ru

Learning content for the GNU operating system and Lisp user space. (https://enzu.ru)

No responses yet