One-liners

One-liners that I find useful, but have to used a search engine every time.

Remove leading and trailing white spaces

awk '{$1=$1};1' <file>

Make dig use /etc/resolv.conf

dig +search +noall +answer <fqdn>

Find DC by querying DNS server for LDAP SRV record

dig +search +noall +answer -t SRV _ldap._tcp.dc._msdcs.<domain>

Generate systemd-networkd route blocks for /32

xargs -a <IPs.list> -I{} echo -e "[Route]\nGateway=192.0.2.254\nDestination={}/32\n"

Last updated

Was this helpful?