Tagged: grep

Display Active Conf in php-fpm pool

Php-fpm pool configuration contains 400+ lines (for example in Ubuntu 16.04). In reality, we may use only about 20 lines or less than 5% of the file. The original configuration file contains lines that explains what each config does. It is good practice to have inline documentation.

In certain cases, we may want to know what lines are actually active. To find that please use the following command…

grep -v '^;\|^$' /path/to/fpm/pool.d/www.conf

What it does:

The ‘-v’ modifier excludes the pattern that immediately follows it.

The quoted string has two parts.

  1. ‘^;’ excludes any lines that do not start with a semi-colon.
  2. ‘^$’ excludes the empty lines

‘|’ modifier combines the above two parts. Finally, ‘\’ modifier is the escape character.