How do i take out the commented lines in the squid.conf file and make the newly created squid file the default config file for my squid proxy server ?


How about sed :

sed -i.bak '/^#/d' /etc/squid/squid.conf

The original file will be saved as /etc/squid/squid.conf.bak. If you don't want to save the original file, use:

sed -i '/^#/d' /etc/squid/squid.conf

Or grep :

grep -v '^#' /etc/squid/squid.conf > /etc/squid/squid.conf.bak && mv /etc/squid/squid.conf.bak /etc/squid/squid.conf

I will not suggest you to just blindly remove all the lines starting with # as they may contain various important info/suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.