Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a command where, when entered outputs information such as:

  • If the network connection is wired or wireless
  • if it is a wireless network, the name of the wireless network
  • How strong the signal is
share|improve this question

2 Answers 2

up vote 2 down vote accepted

Just type in terminal 'iw' and then press Tab and you will see something like iw iw iwconfig iwevent iwgetid iwlist iwpriv iwspy all those are related to wireless internet, try iwconfig to show statistic about signal and network interface.

share|improve this answer

You can make this a shell script for the first question:

#!/bin/bash

if ! /bin/ip route | grep -q ^default; then
  echo "No Internet connection"
  echo
  exit 0
fi
if="$(/bin/ip route | 
  awk '$1 == "default" {for (i=2;i<=NF;i++) if ($i == "dev") { i++;print $i; exit}}')"
if [ -z "$if" -o \! -e /sys/class/net/"$if" ]; then
  echo "Sorry, some error, aborting."
  echo
  exit 1
fi
if /usr/sbin/iw dev "$if" info &>/dev/null; then
  echo "The Internet connection is wireless."
  echo
  # uncomment the next line to start iwconfig
  # iwconfig
else
  echo "The Internet connection is wired."
  echo
fi

You can save this as e.g. ~/scripts/gatewayinfo.sh, make it executable via chmod a+x ~/scripts/gatewayinfo.sh and easily call it by making an alias definition (in e.g. ~/.alias): alias inetinfo="~/scripts/gatewayinfo.sh"

share|improve this answer
    
The above script as a wgettable pastebin: pastebin.com/raw.php?i=JYB3GRFE –  starbeamrainbowlabs Apr 8 at 14:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.