Create a Java path entry for all users

I install Java on all my machines and used to add the java path and home variables to the user (or my user) bash profile but every time I added another user this is a manual step.

Until I found this small trick. Add a system wide profile path setting by creating a file in:


All files in profile.d are added to every users login. Much cleaner than adding it to every user’s profile.

This is the contents of my file:


export JAVA_HOME="/opt/java"
export PATH=$JAVA_HOME/bin:$PATH

These variables are set next time you log in with any user on that system.

Pretty print XML on Linux Command Line BASH

It’s quite handy to indent XML when you need to read it with the human eye, but on a terminal it’s often not as easily readible.
Fortunatly there’s a command which’ll indent it so you can actually read it;
xmllint –format file.xml
This will show you how ugly it could be:

Screenshot Unformatted XML on terminal
Screenshot Unformatted XML on terminal

And behold the indented beauty of this little gem:
Screenshot indented XML on terminal
Screenshot indented XML on terminal