"iw" and some of its commands do not return any output

You need to install wireless_tools

Open a terminal and type the following commands:

aptitude install wireless-tools

Restart network services:

/etc/init.d/networking restart

Update

You need to add interfaces with iw

iw dev wlan0 interface add <name> type <type>

For wired connection:

iw phy phy0 interface add <name> type <type>

There are several modes supported. The modes supported are:

  • monitor

  • managed [also station]

  • wds

  • mesh [also mp]

  • ibss [also adhoc]

Example:

iw phy phy0 interface add moni0 type monitor
iw dev wlan0 interface add wlan0 type station

Install the iw package,

 apt-get install iw

then you will have the iw command.

EDIT:

it is pretty obvious at this moment that you have a bug somewhere. You have the following alternatives:

  1. Since you have a very old kernel, 3.4.90 (see here), you may wish to dramatically update your kernel. There are guides to do this all over Google.

  2. you may try to recompile the device driver, in the hope that the bug is there, not in the old version of iw you run. You do this as follows: downloads Linux backports from here, go to the directory where you downloaded the above file, and give these commands:

    sudo apt-get install linux-headers-$(uname -r) build-essential firmware-realtek
    tar xvfz backports-4.4.2-1.tar.gz
    cd backports-4.4.2-1/
    make defconfig-rtlwifi
    make
    sudo make install
    

Reboot, try your iw commands again. If this fails, I can only suggest updating your old kernel: 3.4 was released in May 2012.