Various Tips and Tricks in Linux Bash

Find wireless device names:

nic=$(cat /proc/net/wireless | awk -F: '/^w/ {print $1}')

Check for internet connectivity:

nc -z 1.1.1.1 53 >/dev/null 2>&1 && echo "online" || echo "offline"

Explanation of the above command:
nc – netcat – Read and write data across networks – arbitrary TCP and UDP connections and listens.
-z Just scan for listening daemons, without sending any data to them.
1.1.1.1 – is a free Domain Name System (DNS) service by the American company Cloudflare in partnership with APNIC.
53 – is the port number associated with Domain Name System
> all standard and error output is directed to the null device
a zero response indicates success “online”, a non-zero response indicates “failure”

Stop/Start Cron Processing in Raspbian (Raspberry Pi OS)

sudo systemctl stop cron.service

sudo systemctl start cron.service