How To Install source-highlight on Ubuntu 20.04

In this tutorial we learn how to install source-highlight on Ubuntu 20.04. source-highlight is convert source code to syntax highlighted document

Introduction

In this tutorial we learn how to install source-highlight on Ubuntu 20.04.

What is source-highlight

source-highlight is:

This program, given a source file, produces a document with syntax highlighting.

It supports syntax highlighting for over 100 file formats, including major programming languages, markup formats, and configuration file formats. For output, the following formats are supported: HTML, XHTML, LaTeX, Texinfo, ANSI color escape sequences, and DocBook.

There are three methods to install source-highlight on Ubuntu 20.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 source-highlight Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install source-highlight

Install source-highlight Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install source-highlight

Install source-highlight 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 source-highlight using aptitude by running the following command:

sudo aptitude -y install source-highlight

How To Uninstall source-highlight on Ubuntu 20.04

To uninstall only the source-highlight package we can use the following command:

sudo apt-get remove source-highlight

Uninstall source-highlight And Its Dependencies

To uninstall source-highlight and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove source-highlight

Remove source-highlight Configurations and Data

To remove source-highlight configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge source-highlight

Remove source-highlight configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge source-highlight

References

Summary

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