Print the ESSID of the wireless network
Cristian Radulescu • August 27, 2021
CLI oneliner to print the ESSID of the wireless network
$ iwconfig > /tmp/essid 2>/dev/null \
&& grep ESSID /tmp/essid \
| awk '{ print $4 }' \
| cut -c 8- | rev | cut -c 2- | rev
Step by step:
- Use iwconfig to fetch wireless info and place it into a file on disk: iwconfig > /tmp/essid 2>/dev/null;
- In the resulted file find the row with ESSID info using grep ;
- Extract only the ESSID info using awk;
- Cut irrelevant strings from the start and end of the actual ESSID (reverse the string to cut the last double quote).