How to compress and minify CSS and JavaScript from the command line

The most well-known tool to minify CSS and JavaScript is YUI Compressor, which is part of YUI (Yahoo! User Interface) JavaScript library written by Yahoo! developers. The common use cases of YUI Compressor is in conjunction with other build tools such as Apache Ant or Maven, where web applications are built automatically minified with the help of YUI Compressor. YUI Compressor can also be used standalone to compress CSS/JavaScript files manually. In this tutorial, I will describe how to compress CSS or JavaScript from the command line on Linux by using YUI Compressor.