Read more

How to inspect XML files in a terminal

Arne Hartherz
July 04, 2013Software engineer at makandra GmbH

You can use xmllint to pretty-print ugly XML files on your terminal. Just say:

xmllint --format file.xml
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

That will restructure containers nicely into individual sections with proper indentation.\
Note that it will automagically work on gzipped XML files!

To write pretty output to a new file, just use the -o switch (short for --output):

xmllint --format file.xml -o pretty_file.xml

See the xmllint man page Show archive.org snapshot for other useful switches and more information.

Posted by Arne Hartherz to makandra dev (2013-07-04 11:17)