[wpseo_breadcrumb]

Creating graphics and presentations on the Linux CLI

Update on:
Oct 4, 2021

In this article, we are going to learn how to make presentations and how to create graphics on the CLI. For this, we are going to use a tool named dialog.dialog is a Linux command-line tool used for taking input from users and to create message boxes.

Prerequisites

Besides having a terminal open, make sure you have the dialog utility installed on your system. Install it by using the apt command. APT stands for Advanced Package Tool. Using the apt command, you can manage software from the command line for debian-based Linux. The apt command easily interacts with the dpkg packaging system.

How to do it

We are going to write a script for a Yes/No box. In that script, we are going to use the if condition. Create the yes_no.sh script and add the following content to it:

dialog --yesno "Do you wish to continue?" 0 0 
a=$? 
if [ "${a}" == "0" ]; then 
	echo Yes 
else 
	echo No 
fi

We’ll use dialog’s calendar. Create a calendar_dialog.sh script. In that, we’ll select a specific date:

dialog --calendar "Select a date... " 0 0 1 1 2018 
val=$?

We’re going to use the checklist option of dialog. Create a checklist_dialog.sh script. In that, we’ll select multiple options:

dialog --stdout --checklist "Enable the account options you want:" 10 40 3 \ 
	1 "Home directory" on \ 
	2 "Signature file" off \ 
	3 "Simple password" off

Now, we are going to write a script to raise the border of an image. Create a raise_border.sh script. We’ll use the convert command with the raise option:

convert -raise 5x5 mountain.png mountain-raised.png

How it works

Now we will see a description of the options and commands written in the preceding scripts:

  • We wrote code for a Yes/No box using the dialog tool in Linux. We used the if condition to take an answer of either Yes or No.
  • We used the --calendar option of the dialog tool. It asks for a date to be selected. We selected a date from the year 2018.
  • We used the checklist option of the dialog tool. We made a checklist, which had three options: Home directory, Signature file, and Simple Password.
  • We raised the border of an image using the convert command and the –raise option, and then the new image was saved as mountain-raised.png.

Related Posts

Upgrading system Off-line with ISO and Yum

Upgrading a system can be a daunting task, especially if it is an off-line system. An off-line system is one that is not connected to the internet and cannot access online resources. The good news is that you can still upgrade your system even when it is not connected...

Configuring Yum

Introduction Yum (Yellowdog Updater, Modified) is a package manager for Red Hat based Linux distributions, including Fedora and CentOS. It helps in managing and updating the software packages on the system, including their dependencies and conflicts. In this article,...

Yum Commands and Options

Introduction Yum is a package manager used in Red Hat-based systems like Fedora, CentOS, and Red Hat Enterprise Linux. With Yum, users can easily install, update, and remove packages from the terminal. In this article, we'll explore the basic Yum commands and their...

Setting up a YUM Repository

Introduction YUM (Yellowdog Updater, Modified) is a popular open-source package management system used to install, update, and remove packages in Linux distributions such as Fedora, Red Hat Enterprise Linux (RHEL), and CentOS. YUM makes it easier to manage packages by...

Follow Us

Our Communities

More on Linux

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

Your email address will not be published.

19 + 4 =