Q: How do I search for a specific text string in a all files?


A: Say you want to find the string "sysadmin" in all files recursively in the folder /root/files.


# grep -R "sysadmin" /root/files/* > /root/files/sysadmin.txt

Saves all found duplicate lines to the file sysadmin.txt.


# sort -u /root/files/sysadmin.txt > /root/files/sysadmin.deduped.txt

Sorts and removes all duplicate lines, leaving one, then saves to the file sysadmin.deduped.txt.