Categories
Command Line Linux Posts

One Line IP Address Bash Command

ifconfig eth0 | sed -n '/^[A-Za-z0-9]/ {N;/dr:/{;s/.*dr://;s/ .*//;p;}}'

So you want to display just your IP address and not all the other stuff that comes with using the ifconfig command. Then use the above command.

It’s useful if you need your IP address in a script but you don’t want to set a static address for your machine, it outputs just the IP address on a single line as shown below:

Categories
Arch Linux HowTo Linux Posts

Wireless showing but fails to up/dhcpcd – Arch Linux

After my installation of Arch Linux I had some trouble using my wifi card which was working while I was running the live CD. What was strange was that the card would show up in iwconfig and ifconfig -a but not ifconfig It turns out I needed to install the wireless drivers and here’s how I did it:

Error:

ifconfig wlan0 up
SIOCSIFFLAGS: No such file or directory

dhcpcd wlan0
dhcpcd: version .2.2 starting
dhcpcd: wlan0: up_interface: No such file or directory
dhcpcd: wlan0: waiting for carrier
dhcpcd: timed out

Find out what card you are using:

lspci | grep Network
04:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)

Install: iwlwifi-3945-ucode-15.32.2.9-2-any.pkg.tar.gz

If you don’t have access to a wired connection, check out this guide to installing packages from the Arch Linux cd.

Once you get it up and running, updating via pacman (-Syu) will probably replace these drivers for newer ones which continue to work.