Simple GREP grep CPU: /var/run/dmesg.boot Count grepped lines grep WARNING /var/run/dmesg.boot -c Search by entire word grep -w 'seven' test.txt Search by word start or end grep '\<seven' test.txt grep 'seven\>' test.txt Search by start or end of line grep '^seven' test.txt grep 'seven$' test.txt Show nearby lines of found grep -C 1 twentyseven test.txt grep -A 1 twentyseven test.txt # onle above grep -B 1 twentyseven test.txt # only below By regular expr grep "twenty[1-4]" test.txt grep "twenty[^1-4]" test.txt grep -E '\b[0-9]{1,3}(\.[0-9]{1,3}){3}\b' /etc/resolv.conf #ip grep -oE '\b[0-9]{1,3}(\.[0-9]{1,3}){3}\b' /etc/resolv.conf Exclude grep '_blank' -r ./libs --exclude-dir="libs/mooa" --exclude="*.json"