Tech Tip: View Config Files Without Comments
I've been using this grep invocation for years to trim comments out of config files. Comments are great but can get in your way if you just want to see the currently running configuration. I've found files hundreds of lines long which had fewer than ten active configuration lines, it's really hard to get an overview of what's going on when you have to wade through hundreds of lines of comments.
$ grep ^[^#] /etc/ntp.conf
The regex ^[^#] matches the first character of any line, as long as that character that is not a #. Because blank lines don't have a first character they're not matched either, resulting in a nice compact output of just the active configuration lines.
- Open-Source Space
- Silicon Mechanics Gives Back
- Numerical Python
- Reglue: Opening Up the World to Deserving Kids, One Linux Computer at a Time
- New Storage Solution is Music to the Ears of Fast-Growing Digital Music Company
- Our Assignment
- Talking to Twitter
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Quantum Cryptography
- Linux Systems Administrator