Listing only active configuration from filename using grep

Imagine a situation that  you want to see only the active configuration of squid.conf which is having 3532 line, to see the configuration you have to navigate through whole file from top to bottom, use this command to make your life easier.

# grep ^[^#] squid.conf

This will show only the files which are not starting with #,  means the active configuration you made in whole file, may be 5 or 10 lines.

Command Description

# grep ^[^#] filename

grep – filtering command

^ –  starting of the line

[^#] – ^ inside [ ] having different meaning (you have to learn regular expression ), [^] means “not” # the symbol, this could be anything # or @ or $ or anything.

filename – filename

About Anoop Nair

I am a Linux and Networking geek, Interest to learn more and fun to do new experiments, happy to share knowledge that I have learned and experienced in my life and carrier, also trying to learn more on Firewalls, Linux, Switching, Routing etc..............

Check Also

MySql replication

Disaster recovery of Mysql using DRBD and Heartbeat

Disaster recovery (DR) is the process, policies and procedures that are related to preparing for …