Build a Linux bash GUI with Whiptail

Share this post to your friends !

This entry is part 1 of 1 in the series Build a Linux bash GUI with Whiptail

WriteBash - 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.

danie@danie-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.

$ bash

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

build-a-linux-bash-gui-with-whiptail-01 Build a Linux bash GUI with Whiptail
Build a simple linux bash gui.
build-a-linux-bash-gui-with-whiptail-02 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.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.

Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.