When working with configuration files, we are usually dealing with hundreds of lines, sometimes thousands of lines. There is an easy way for us to list only the uncommented lines. This is useful to check whether the setting that we have done is correct.
To show only the uncommented line for file.conf (this is for the configuration files that use # as comment) :
- $ grep -v ^# file.conf | grep -v ^$
- "grep -v ^#" means list out everything that do not start with #
- "grep -v ^$" means list out everything that do not start with blank space