I have the wifi router plugged in thru a usb hub. What i was missing was setting up the ssid and psk in the wpa_supplicant.conf file. The moment i set it up and rebooted the pi it started working. I'm able to connect and work with it in SSH mode. It is awesome
Thank you for you help MrEngman.