Linux Development Setup
As a developer, you need a productive development environment. One that doesn’t distract but still is highly customizable, allows scripting of frequent tasks, makes everyday tasks easy and comes with a healthy ecosystem of powerful tools. Linux is such an environment. However, while it’s powerful out of the box, you probably want to customize it to your specific needs as a developer.
I’ll show you my setup, so that you can get inspiration from it to improve your development setup. I’m not going in-depth into the installation process of the components mentioned here, because that might change between versions and therefore you better consult the component’s documentation. What I will show is why I selected the components that I use and how they help me.
CLI Customization
Where Linux really shines is the CLI. Each Linux distribution comes with a certain CLI flavor or shell. A commonly used (and default) shell is Bash. Each shell has its own set of benefits and the nice thing is that you can rather easily switch to a different shell when you’re setting up your environment.
Instead of the default Bash shell, I went with the Z shell, or Zsh. Its use is very similar to Bash. You probably won’t notice the difference when you switch in terms of commands. However, it uses some distinct set of files in your home directory to initialize itself. These are the ones I commonly use, with their equivalent in Bash:
~/.zprofile: similar to ~/.bash_profile
~/.zshrc: similar to ~/.bashrc
So what makes this shell worth the switch?
- no need to type
cd
(change directory) anymore, just type the name of the directory and press enter. Done. - you can use shorthands that will automatically expand when you tab, like
/h/y/d/proj
which will expand on my machine to/home/yennick/dev/projects
- but by far my favorite: it opens up the door to Oh My Zsh.
Oh My Zsh
The actual power of using the Zsh shell comes through Oh My Zsh. This is a community-driven framework of themes and plugins for Zsh. So let’s have a look at the themes and plugins which I use.
Powerlevel10k
Powerlevel10k is a theme for Zsh which allows you to customize the prompt’s style and the information that it shows. You can install it for several plugin managers, and one of them is Oh My Zsh. I’ve configured mine to look like this:
I’ve only configured a selection of the options that are available, but what you see here are the following segments:
dir
: The directory I’m currently in, which automatically collapses the first few directories when it becomes too longvcs
: git information which shows the branch I’m on (live
) and the number of changesstatus
: the result status of the last command that I executed, which is either a checkmark when the result was ok, or the exit code if it was a failurerbenv
: ruby version from rbenv that I’m using (2.6.4
)time
: time at which the command was executed
There are a lot more segments available, so certainly check out the documentation of the theme.
zsh-interactive-cd
This plugin allows you to select folders and files interactively while you’re browsing directories with cd
and press tab.
auto-completion and aliases plugins for common developer tools
I’m also using several plugins which add auto-completion and aliases for common developer tools, such as:
yarn
: the Yarn package manager used in front-end developmentdocker
: for managing Dockerkubectl
: for working with Kubernetes clusters
There are a bunch more to explore.
Using a developer font
Not all fonts are created equal, and certainly when you’re a developer. You’re looking at a font the whole day, so you better want it to be easy to read and easy on the eyes. That’s where nerdfonts.com comes in. It has a large catalog of developer targeted fonts which are patched with lots of glyphs. You can configure these fonts for your CLI, but also use them in your preferred IDE.
My recommendation: Caskaydia Cove Nerd Font
Managing Packages
Each Linux distribution already comes with its own package manager (apt, yum, …), but coming from OSX I prefer Homebrew. It provides me a single cli-based interface to install packages on any Linux distribution or on OSX.
Packages are also more up-to-date. Package maintainers can publish to Homebrew and have their packages available for all Linux distros, where otherwise they would have to publish to all distro-specific package registries. This trickles down to the users of Homebrew, which get faster updates and more packages.
Managing SDKs
As developers, and certainly as full-stack developers, we use quite a few SDKs. And worse, the SDK requirement can be different per project. Therefore, something that allows you to install certain SDK versions easily and to activate a version per project selectively can come in handy. That is why I use SDK managers.
- SDKMAN!: For all JVM-based SDKs (Java, Scala, Kotlin) or related build tools (such as Scala’s Sbt build tool) I use SDKMAN.
- rbenv + ruby-build: rbenv allows you to select a Ruby version per project. ruby-build allows you to install a new ruby version easily.
- pyenv: to manage Python versions
- nvm: to manage Node versions
Power Tools
I also use several other tools to make my life easier.
Keychain
Tired of having to enter your password repeatedly when you use an ssh key multiple times during the same session? Keychain helps you manage SSH keys so that you only have to enter your password once when your machine has been rebooted.
Fzf
Fzf provides an interactive fuzzy finder to your command-line. You can pipe pretty much anything to it and then fuzzy search it.
Sheet
Command-line note taking and creating snippets is super easy with Sheet, a Ruby-based tool. I use it regularly to save more complex one-liner commands that I occassionaly need, but always forget. Searching those notes gets even easier when you pipe the list of notes through Fzf, so that you can fuzzy search them.
It will save the sheets to the ~/.sheets
folder in your home directory, so are easily accessible if you want to back them up.
jq/yq
jq is a light-weight JSON processor for the command-line. When you have json output from another command, you can pipe it through the jq
command to filter or nicely format it.
yq does the same for YAML output.
fkill-cli
Sometimes you need to kill a process, but it’s always a bit tedious to find the process, copy its process id and use it in the kill
command. Instead, I use fkill-cli, which provides an interactive CLI to search and kill a process.