Configuring a static IP on HypriotOS for the Raspberry Pi

How you configure a static IP on the Pi changed between Wheezy and Jessie, and it seems on Hypriot’s prebuilt images for running Docker on the Pi, it’s a slight variation.

Edit /etc/network/interfaces.d/eth0, comment out the DHCP line:

iface eth0 inet dhcp

and add:

iface eth0 inet static
address your-static-ip
gateway your-gateway-ip
#google dns servers
domain_name_servers=8.8.8.8, 8.8.4.4

Done!

Prepending text to a file with sed

Appending content to a file on Linux is pretty easy with >> but there’s no equivalent redirection to prepend content. Luckily, for every file manipulation problem on Linux there’s at least a dozen solutions.

Using sed with -i for inplace replacement of content in a file, you can match ^ for start of line, and then follow with the content you want to replace (in this case, insert).

VNC remote desktop to a Raspberry Pi

I normally ssh into my remote Raspberry Pi’s, but if you don’t have then attached to a monitor and need to get a desktop view of what’s going on, a VNC remote connection works great. Step by step instructions here.

Selecting multiple files in Midnight Commander

At one point file managers like Midnight Commander were the best thing ever. I just came across Midnight Commander on the RetroPie install for managing game roms, and got stuck trying to work out how to select multiple files. Pressing Insert selects/deselects.

There’s a good intro to using MC here.