Making Terminal Your Home

Home is where you feel comfortable and safe. It’s your place that you can organize stuff to your convention. The very same feeling with your with your terminal can empower you and increase your productivity greatly.

The reason why I prefer terminals is not because that they make you cool. While I don’t deny that they indeed make you cool, the main reason is that they provide you only the most essential data, text streams. Terminals provide you the most condensed data over sole texts. This enables you to enhance your focus and increase your perception. Small and simple programs as building blocks lets you to implement more complex solutions. Of course, this is thanks to GNU1 and other Linux tools.

For me, they are the great product of the Unix philosophy2.

I firmly believe that making yourself comfortable with terminals enables you a great potential. That is why I would like to give you some basic but effective features that I use in my environment. This post will be mostly based on my dotfiles3.

Before we jump on, I recommend you switch to en-US keyboard layout when interacting with terminal applications. Most of the time, the shortcuts are designed with en-US keyboard layout in mind. For this reason, having two keyboard layouts one for your native layout and one for en-US would be beneficial.

Often times I forget a command I have issued before, or I don’t want type it over again. Terminals have a buffer and history file that holds records of past commands. The file is pointed via HISTFILE environment variable. While you can click up arrow in your keyboard to iterate over most recent commands, terminals also have reverse search functionality.

This functionality is bound to ctrl-r key combination. After activating reverse search panel, you can start typing to begin your search from your buffer and history file. Among the results you can navigate and select the entry you want. In my environment, I have this functionality integrated with fzf4 which enhances this even more. The integration of fzf can be found here.

Directory navigation

It may be the case where you have many directories, or even worse, many nested directories. In situations like this, the directory navigation can easily turn into torture. I can’t image all the cd commands that were issued into wrong directory. For this reason, fzf has yet another feature called fzf_cd. What this feature essentially does is It executes find to list all possible directories and enables you to make search on them. Much like reverse search, except this time upon selecting a entry, fzf automatically takes you there. On my system this is bound to alt-c key combination.

Text navigation

Terminals are all about text streams. Invoking applications and providing them arguments are all made via texts. But we are human beings and we can typo a lot. Sometimes we can notice our typos way after we wrote a long command. It can be cumbersome to move the cursor over typo and fix it. Terminals have shortcuts for text navigation. The one I use the most is ctrl-<left/right arrow> key combination to jump over words. There are also other key combinations to delete words, go to line beginning, crop everything preceding/trailing cursor and many others.

Tmux

We may need multiple terminals at the same time depending on the task we are busy with. Switching between multiple terminal windows and aligning them can be a burden. That’s where Tmux5 comes into play. Tmux stands for terminal multiplexer. It has features like splitting panes, creating windows and sessions.

Tmux is highly customizable to fit into your convention. I find the default key combinations of Tmux confusing. You can my customized key combinations here.

Not only the key combinations, the theme is customizable as well. In fact, you can find my minimal theme customization at here.

Conclusion

As for parting words, I would like to share a final act to show you my daily development environment combining all the tools to show you much more is possible with terminals. Hope that can inspire and motivate you into terminals.

I encourage you to check out my dotfiles repostiory and play around.


  1. https://www.gnu.org/philosophy/categories.html#GNUsoftware ↩︎

  2. http://www.catb.org/~esr/writings/taoup/html/ch01s06.html ↩︎

  3. https://github.com/ucan35/dotfiles ↩︎

  4. https://github.com/junegunn/fzf ↩︎

  5. https://github.com/tmux/tmux ↩︎