Build a Linux bash GUI with Whiptail

by Daniel Pham
Published: Updated:
This entry is part 1 of 1 in the series Build a Linux bash GUI with Whiptail

In this first article, I introduce you to a tool called Whiptail. This is a program that allows you to build simple GUI applications for shell/bash scripts.

You can read more about the build GUI application for bash scripts with Zenity.

How to install Whiptail?

Installing whiptail on Linux is quite simple.

For Ubuntu operating system and Ubuntu base, you use the following command.

sudo apt-get install whiptail -y

For CentOS and base CentOS operating systems, use the following command.

sudo yum install newt -y

After the installation is complete, you can check the current version of the installed program.

daniel@daniel-laptop:~/Desktop$ whiptail -v
whiptail (newt): 0.52.20

Build the first bash GUI application with Whiptail

Now, we will do a simple example with Whiptail. Copy the contents of the script below onto your computer and name the file, for example,


NAME=$(whiptail --inputbox "Type name of the blog:" 8 78 Name --title " GUI" 3>&1 1>&2 2>&3)


if [ $exitstatus = 0 ]; then
        echo "Type name Ok and entered" $NAME
        echo "Welcome to $NAME" > name_test 
        whiptail --textbox name_test 12 80
        echo "Type name Cancel."

echo "(Exit status was $exitstatus)"

Next you use the command below to run the script.


And see what happens. An interface you’ve probably encountered somewhere, right?

Build a Linux bash GUI with Whiptail
Build a simple linux bash gui.
Build a Linux bash GUI with Whiptail
Results when running the gui application.

There are a lot of setup programs that use the GUI to look like that.


At this point, you will not fully understand how to use whiptail but that’s okay, in the next articles, I will show you how to use it. Using Whiptail will help you be able to build your applications more user friendly. Not always just the command line.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.