Below will list all of the files that are used for apache authentication in /var/www/html file path:
find /var/www/html -name .htaccess | xargs awk '{sub(/^[ \t]+/,"")};/File/{pr int $2}' | sort | uniq
Here is the breakdown:
find /var/www/html -name .htaccess
Find all files named ".htaccess" at path "/var/www/html"
xargs awk '{sub(/^[ \t]+/,"")};/File/{pr int $2}'
The search output gets piped via xargs to awk, deleting leading whitespace (spaces and tabs) from front of each line and output is of only the second field of lines containing the text "File".
sort | uniq
Awk output is further piped through sort and uniq which results in the files being used for apache authentication.
- sandip's blog
- Login or register to post comments