Hello, in this post, I’m going to stray a little from the project’s theme, but still, in a way, very connected to the DevOps life, especially for those who use the terminal a lot like me.

I really like it and prefer to use terminal for my work tasks, DevOps, database and systems administration. Of course, for everyday use the graphical interface is irreplaceable, but I still prefer Linux. As a personal computer I use Debian, and professionally I use Mac.

But getting back to the topic of the post, I want to talk a little about TUIs: text-based user interfaces OR terminal user interfaces, whichever you prefer. You can see in my posts that I always prefer to use examples, the commands of the tools themselves, but in everyday life, a TUI helps a lot.

TUIs are text-based tools for use in the terminal that help with tasks for a particular tool.

I will leave here some examples and, as far as possible, how I configure this project. Some TUIs have terrible documentation, setting them up is a real egg hunt.

Kubernetes

K9s

https://github.com/derailed/k9s – K9s provides a terminal UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe and manage your applications in the wild. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with your observed resources.

It’s one of the ones I use the most. It’s very easy to use, once you have configured your context file “$HOME/.kube/config” you can navigate between Kubernetes objects in a simple way. Start by typing the colon and then the object type, for example, pod, service, etc… tab to autocomplete and then press enter to change to the view you want.
At the top, you will see the keys you can use to manipulate what you need.

KTop

https://github.com/vladimirvivien/ktop

Kubectx

https://github.com/ahmetb/kubectx

File Manager

BRoot

https://github.com/Canop/broot

Broot is the file manager I liked the most so far, with some simple settings it was just to my liking. For example, I created some extra shortcuts, for code, vi and exiting Broot and changing the focus directory.

https://github.com/faustobranco/devops-db/tree/master/knowledge-base/linux/tui/broot

vi ~/.config/broot/verbs.hjson

    {
        invocation: quit
        key: ctrl-x
        execution: "cd {directory}"
        from_shell: true
        set_working_dir: true
        leave_broot: true
    }    
    {
        invocation: vi
        shortcut: e
        key: ctrl-e
        apply_to: text_file
        execution: "vi {file}"
        leave_broot: false
    }
    {
        invocation: code
        execution: "code {file}"
        leave_broot: false
    }   

I like to start the broot with the size and date columns:

br -sd

Database

Rainfrog

https://github.com/achristmascarl/rainfrog

A TUI that I really like, a simple database manager that does a lot, has great usability. In my opinion there are still some things to improve or change, mainly the documentation. But it’s great, and the support from the Git team is very fast.

https://github.com/faustobranco/devops-db/tree/master/knowledge-base/linux/tui/rainfrog

vi ~/.config/rainfrog/rainfrog_config.tom

[db]
postgres-vault-devops-db = { connection_string = "postgres://usr_vault:efDZGo92Cco3u1Zh@postgresql.devops-db.internal:5432/vault_secrets", driver = "postgres" }
postgres-terraform-devops-db = { host = "postgresql.devops-db.internal", driver = "postgres", port = 5432, database = "db_terraform_backend", username = "terraform_backend"}
postgres-local-atuin = { host = "127.0.0.1", driver = "postgres", port = 5432, database = "db_atuin", username = "usr_atuin"}

[settings]
mouse_mode = true
macos_option_as_alt = false

[keybindings.Menu]
"<Ctrl-c>" = "AbortQuery"
"<Ctrl-x>" = "Quit"
"q" = "AbortQuery"
"<Alt-1>" = "FocusMenu"
"<Alt-2>" = "FocusEditor"
"<Alt-3>" = "FocusData"
"<Alt-4>" = "FocusHistory"
"<Alt-5>" = "FocusFavorites"
"<Ctrl-s>" = "FocusMenu"
"<Ctrl-q>" = "FocusEditor"
"<Ctrl-r>" = "FocusData"
"<Ctrl-h>" = "FocusHistory"
"<Ctrl-f>" = "FocusFavorites"
"<Tab>" = "CycleFocusForwards"
"<Backtab>" = "CycleFocusBackwards"

[keybindings.Editor]
"<Ctrl-c>" = "AbortQuery"
"<Ctrl-x>" = "Quit"
"q" = "AbortQuery"
"<Ctrl-e>" = "SubmitEditorQuery"
"<F5>" = "SubmitEditorQuery"
"<Alt-1>" = "FocusMenu"
"<Alt-2>" = "FocusEditor"
"<Alt-3>" = "FocusData"
"<Alt-4>" = "FocusHistory"
"<Alt-5>" = "FocusFavorites"
"<Ctrl-s>" = "FocusMenu"
"<Ctrl-q>" = "FocusEditor"
"<Ctrl-r>" = "FocusData"
"<Ctrl-h>" = "FocusHistory"
"<Ctrl-f>" = "FocusFavorites"
"<Backtab>" = "CycleFocusBackwards"

[keybindings.History]
"<Ctrl-c>" = "AbortQuery"
"<Ctrl-x>" = "Quit"
"q" = "AbortQuery"
"<Alt-1>" = "FocusMenu"
"<Alt-2>" = "FocusEditor"
"<Alt-3>" = "FocusData"
"<Alt-4>" = "FocusHistory"
"<Alt-5>" = "FocusFavorites"
"<Ctrl-s>" = "FocusMenu"
"<Ctrl-q>" = "FocusEditor"
"<Ctrl-r>" = "FocusData"
"<Ctrl-h>" = "FocusHistory"
"<Ctrl-f>" = "FocusFavorites"
"<Tab>" = "CycleFocusForwards"
"<Backtab>" = "CycleFocusBackwards"

[keybindings.Data]
"<Ctrl-c>" = "AbortQuery"
"<Ctrl-x>" = "Quit"
"q" = "AbortQuery"
"<Alt-1>" = "FocusMenu"
"<Alt-2>" = "FocusEditor"
"<Alt-3>" = "FocusData"
"<Alt-4>" = "FocusHistory"
"<Alt-5>" = "FocusFavorites"
"<Ctrl-s>" = "FocusMenu"
"<Ctrl-q>" = "FocusEditor"
"<Ctrl-r>" = "FocusData"
"<Ctrl-h>" = "FocusHistory"
"<Ctrl-f>" = "FocusFavorites"
"<Tab>" = "CycleFocusForwards"
"<Backtab>" = "CycleFocusBackwards"

[keybindings.Favorites]
"<Ctrl-c>" = "AbortQuery"
"<Ctrl-x>" = "Quit"
"q" = "AbortQuery"
"<Alt-1>" = "FocusMenu"
"<Alt-2>" = "FocusEditor"
"<Alt-3>" = "FocusData"
"<Alt-4>" = "FocusHistory"
"<Alt-5>" = "FocusFavorites"
"<Ctrl-s>" = "FocusMenu"
"<Ctrl-q>" = "FocusEditor"
"<Ctrl-r>" = "FocusData"
"<Ctrl-h>" = "FocusHistory"
"<Ctrl-f>" = "FocusFavorites"
"<Tab>" = "CycleFocusForwards"
"<Backtab>" = "CycleFocusBackwards"

[keybindings.PopUp]
"<Ctrl-c>" = "AbortQuery"
"<Ctrl-x>" = "Quit"
"q" = "AbortQuery"

export RAINFROG_EXPORT=~/Documents
export RAINFROG_CONFIG=~/.config/rainfrog
rainfrog

[0] postgres-local-atuin
[1] postgres-terraform-devops-db
[2] postgres-vault-devops-db
Input index of desired database:

Bash History

Atuin

https://atuin.sh/

Sync, search and backup shell history with Atuin.
Very easy to use, searches are fast and great. I made some changes like search mode, changed the behavior when we press up arrow, etc.


Interesting points, it is possible to synchronize the history, encrypted with an Atuin server and the history can be shared with other computers you want, through login and key exchange.


You can also create a self-hosted PostgreSQL for this, which is what I did, and it doesn’t send your sensitive commands to any other site. This involves creating a server (Docker Container) to sync with Atuin and a PostgreSQL database, but it’s worth it.

https://github.com/faustobranco/devops-db/tree/master/knowledge-base/linux/tui/atuin/config

vi ~/.config/atuin/config.toml

auto_sync = true
update_check = true
sync_frequency = "0"
search_mode = "fulltext"
inline_height = 40

Monitoring Resources

BTop

https://github.com/aristocratos/btop

GTop is a spectacular TUI Process Manager, with so many features that it puts most graphical system monitors to shame.

Docker

Lazydocker

https://github.com/jesseduffield/lazydocker

LazyDocker, I think it’s one of the best-known TUIs for Docker, it’s not exactly what I would like to have, especially as a K8s fan, there are other TUIs for Docker and one of them even comes close to K9s, but it has a lot of different shortcuts and still has a lot of bugs.
But, despite the preference, for now LazyDocker has served me 100%.

Dive

https://github.com/wagoodman/dive

To work with Docker/K8s images and have a very detailed view, especially of the layers, Dive is unbeatable. For tuning, performance, etc. I always use this app.

Miscellaneous

LSSH

https://github.com/blacknon/lssh

LSSH is another TUI that is on my most used list, I can’t live without it. It uses among other config, the ssh config itself to manage your hosts for SSH, FTP, etc.
As I sometimes have huge lists of hosts, TUI solves my problems, it has a very easy to use search.