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:

  1. Use iwconfig to fetch wireless info and place it into a file on disk: iwconfig > /tmp/essid 2>/dev/null;
  2. In the resulted file find the row with ESSID info using grep ;
  3. Extract only the ESSID info using awk;
  4. Cut irrelevant strings from the start and end of the actual ESSID (reverse the string to cut the last double quote).