A smoke-jumping admin's best friend

TUI Tools

Writing TUIs

Rather than just present a list of TUI applications that can be used for administration or as everyday applications, I will illustrate that it is fairly straightforward to write these applications, particularly for administration tasks.

A few main libraries or toolkits have been helpful; the first, and probably largest, is curses [19]. Originally written in the late 1970s, curses was optimized and expanded in the early 1980s for the video game Rogue [20]. It then began to be used for a number of applications. Development of curses slowed down, and a new library, ncurses [21], was developed that proved to be more popular than curses. As part of the GNU Project, it is still being developed, although at a slower pace. Figure 1 shows a sample ncurses screenshot.

Figure 1: Ncurses-based menuconfig (Wikipedia, CC BY-SA 3.0).

Another option is Newt [22], a programming library that focuses on color TUIs (Figure 2) and uses a widget approach, making programming a TUI much easier. With Newt, you can create stacked windows, entry widgets, checkboxes, radio buttons, labels, plain text fields, scrollbars, and so on. In Python, this library is referred to as snack and was originally developed for Red Hat's TUI installer, Anaconda.

Figure 2: The Partimage tool uses Newt to create its user interface (Wikipedia, GPL).

A number of tutorials on the web can guide you in using Newt with pretty much any desired language. (Sorry, Fortran users, I don't see anything for us yet.) Python is a fairly common language for using Newt (python-snack ), and Jupyter Notebook [23] can help you learn Newt in Python.

Another useful TUI library that can be used with Python and Bash is called dialog [24], which you can use to create pop-up dialog boxes from Bash scripts (Figure 3). Furthermore, dialog has been rolled into a Python library named, aptly enough, pythondialog [25], which allows you to use dialog boxes and other constructs from the dialog library in your Python code.

Figure 3: Sample pop-up dialog from Bash script: dialog --title "Message" --msgbox 'Your job is done' 6 20.

If you are interested in writing TUIs for system administration, a great place to start is with the psutil library, which is great for gathering system statistics. Then, you can take a look at the scripts subdirectory [26] on GitHub, where you can find a number of sample scripts for creating a TUI (e.g., the top clone top.py [27]). You can also look at other TUIs to understand how to create plots, strip charts, and other useful features. Don't forget, these interfaces are all text based and can be easily used over port 22 (SSH).

Be sure to examine the admin tools mentioned in Table 1. The charting capability, even with just text-based graphics, is great. I love using these tools to get a simple view of how a node is behaving. Take a look at the code and even think about a way to make a function for creating these plots (please create Python interfaces to make life easier).


A system administrator's job is to keep systems running smoothly and effectively at all times, which means having to triage misbehaving nodes from time to time. In High Performance Computing (HPC), these nodes often don't have a display adapter or have one that is having problems. Being able to log in to the node and use quasi-graphical interfaces over port 22 is a real blessing. You can test applications and monitor the system with the use of TUIs. Although often ignored, believe me, they are very useful in the admin world.

Moreover, TUIs are not difficult to write. With tools from various libraries and the help of online examples, you can create your own custom tool. Python or C is a great way to get started. If you write something or use TUIs on a daily or weekly basis, please give a shout-out on Twitter – I'm sure everyone would love to learn more.


  1. bmon: https://www.youtube.com/watch?v=DvjuxPczOFM
  2. nmon: https://www.youtube.com/watch?v=3PiYabquJBQ
  3. htop article: https://www.tecmint.com/htop-vs-top-in-linux/
  4. htop video: https://www.youtube.com/watch?v=ZnEDfqr4Rm0
  5. iftop: https://www.youtube.com/watch?v=b0eIMkAmBNA
  6. vtop: https://www.youtube.com/watch?v=y3ylZl-aFFg
  7. iptraf: https://www.youtube.com/watch?v=cO0huATNxps
  8. Glances: https://www.youtube.com/watch?v=TQgB0MD9crA
  9. atop article: https://www.tecmint.com/how-to-install-atop-to-monitor-logging-activity-of-linux-system-processes/
  10. atop video: https://www.youtube.com/watch?v=PRZTDH9RwT0
  11. dstat: https://www.youtube.com/watch?v=Fln8KvcOSCs
  12. psutil: https://www.youtube.com/watch?v=gNl5svb8d-E
  13. system-config-firewall-tui: https://www.youtube.com/watch?v=PKWgQbQCvR8
  14. neoleo: https://blippy.github.io/neoleo/
  15. Midnight Commander: http://midnight-commander.org/wiki/doc
  16. SC-IM: https://github.com/andmarti1424/sc-im/wiki/Building-SC-IM
  17. Mutt: http://www.mutt.org/
  18. ncdu: https://dev.yorhel.nl/ncdu/man
  19. Curses: https://en.wikipedia.org/wiki/Curses_(programming_library)
  20. Rogue: https://en.wikipedia.org/wiki/Rogue_(video_game)
  21. Ncurses: https://en.wikipedia.org/wiki/Ncurses
  22. Newt: https://en.wikipedia.org/wiki/Newt_(programming_library)
  23. Jupyter Notebook: http://nbviewer.jupyter.org/gist/shreddd/7589115
  24. dialog: https://en.wikipedia.org/wiki/Dialog_(software)
  25. pythondialog: http://pythondialog.sourceforge.net/
  26. Scripts subdirectory: https://github.com/giampaolo/psutil/tree/master/scripts
  27. top.py: https://github.com/giampaolo/psutil/blob/master/scripts/top.py

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus