xmlstarlet command not found

In this troubleshooting guide we learn how to fix xmlstarlet command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

xmlstarlet: command not found

or when using sudo you get the following error message

sudo: xmlstarlet: command not found

Solutions to xmlstarlet: command not found

How To Fix xmlstarlet: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu xmlstarlet is provided by xmlstarlet package.

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

To fix this problem, we can install more using the command below.

sudo apt-get -y install xmlstarlet

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install xmlstarlet.

sudo apt -y install xmlstarlet

Or if you have aptitude installed you can use the following command.

sudo aptitude install xmlstarlet

Summary

In this tutorial we learn how to fix xmlstarlet command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.