How To Install xmlstarlet on Ubuntu 22.04

In this tutorial we learn how to install xmlstarlet on Ubuntu 22.04. xmlstarlet is command line XML toolkit

Introduction

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

What is xmlstarlet

xmlstarlet is:

XMLStarlet is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files using simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands.

This set of command line utilities can be used by those who deal with many XML documents on UNIX shell command prompt as well as for automated XML processing with shell scripts.

The toolkit’s feature set includes options to: Check or validate XML files (simple well-formedness check, DTD, XSD, RelaxNG) Calculate values of XPath expressions on XML files (such as running sums, etc) Search XML files for matches to given XPath expressions Apply XSLT stylesheets to XML documents (including EXSLT support, and passing parameters to stylesheets) Query XML documents (ex. query for value of some elements of attributes, sorting, etc) Modify or edit XML documents (ex. delete some elements) Format or “beautify” XML documents (as changing indentation, etc) Fetch XML documents using http:// or ftp:// URLs Browse tree structure of XML documents (in similar way to ’ls’ command for directories) Include one XML document into another using XInclude XML c14n canonicalization Escape/unescape special XML characters in input text Print directory as XML document Convert XML into PYX format (based on ESIS - ISO 8879), and vice versa

There are three methods to install xmlstarlet 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 xmlstarlet Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install xmlstarlet

Install xmlstarlet Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install xmlstarlet

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

sudo aptitude -y install xmlstarlet

How To Uninstall xmlstarlet on Ubuntu 22.04

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

sudo apt-get remove xmlstarlet

Uninstall xmlstarlet And Its Dependencies

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

sudo apt-get -y autoremove xmlstarlet

Remove xmlstarlet Configurations and Data

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

sudo apt-get -y purge xmlstarlet

Remove xmlstarlet configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge xmlstarlet

References

Summary

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