How To Install ghostscript on Ubuntu 22.04

In this tutorial we learn how to install ghostscript on Ubuntu 22.04. ghostscript is interpreter for the PostScript language and for PDF

Introduction

In this tutorial we learn how to install ghostscript on Ubuntu 22.04.

What is ghostscript

ghostscript is:

GPL Ghostscript is used for PostScript/PDF preview and printing. Usually as a back-end to a program such as ghostview, it can display PostScript and PDF documents in an X11 environment.

Furthermore, it can render PostScript and PDF files as graphics to be printed on non-PostScript printers. Supported printers include common dot-matrix, inkjet and laser models.

There are three methods to install ghostscript on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install ghostscript Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install ghostscript using apt-get by running the following command:

sudo apt-get -y install ghostscript

Install ghostscript Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install ghostscript using apt by running the following command:

sudo apt -y install ghostscript

Install ghostscript Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install ghostscript using aptitude by running the following command:

sudo aptitude -y install ghostscript

How To Uninstall ghostscript on Ubuntu 22.04

To uninstall only the ghostscript package we can use the following command:

sudo apt-get remove ghostscript

Uninstall ghostscript And Its Dependencies

To uninstall ghostscript and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove ghostscript

Remove ghostscript Configurations and Data

To remove ghostscript configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge ghostscript

Remove ghostscript configuration, data, and all of its dependencies

We can use the following command to remove ghostscript configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge ghostscript

References

Summary

In this tutorial we learn how to install ghostscript package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.