grep

Table of Contents

1. Match exactly non-free component found in APT sources files

Using \b to delimit by word is not enough as it will also return non-free-firmware

grep -r 'non-free[^-]' /etc/apt/sources.list /etc/apt/sources.list.d/

2. Return IP addresses from journalctl output

See journalctl

journalctl -b -t sshd-session | grep -oE '[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}'

Or to return IP addresses from ufw logs

journalctl -b -t kernel | grep -oE 'SRC=[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}'

3. References