How to find status of wlan0?

25,763

Solution 1

The current (in 2017) methods are:

  1. ip for all network interfaces, including setting up and down:

    ip link set wlan0 up
    ip link set wlan0 down
    ip help
    ip link help
    ip addr help
    
  2. iw for wireless extensions (needs to be called as root):

    iw dev
    iw phy
    iw wlan0 scan
    iw wlan0 station dump
    iw help
    

ifconfig and iwconfig are still supported with the appropriate packages, but some features are only available with ip and iw.

Solution 2

The net-tools program is deprecated and the iproute2 has been used to replace it :

program     obsoleted by
arp         ip neigh
ifconfig    ip addr
ipmaddr     ip maddr
iptunnel    ip tunnel
route       ip route
nameif      ifrename
mii-tool    ethtool

The ip show will display the state of your network interface.

in addition there are some others tools will help you to get the state of your network interface :

cat /sys/class/net/<interface>/carrier

sample output:

1

the 1 mean your interface is up and 0 is down.

Or simply you can use the following command :

cat /sys/class/net/<interface>/operstate

sample output:

UP

or

DOWN
Share:
25,763

Related videos on Youtube

shirish
Author by

shirish

A GNU/Linux and Debian user. Debian user for more than 5 years and yet still feel like a kid who has just started using the system yesterday.

Updated on September 18, 2022

Comments

  • shirish
    shirish over 1 year

    From what I had read sometime back, it seems iwconfig is deprecated and the current methods is -

    $ sudo ifconfig wlan0 up
    

    and

    $ sudo ifconfig wlan0 down
    

    But couldn't find anything which tells the status of the wifi and know which mode it is on, which AP it is attached to, how much data is being transferred and so on and so forth on the CLI.