Alias is your friend

I regularly use ls -la to list directory contents on my Raspberry Pi. I often use ls -lah to also display hidden files. This week I wondered if there was a way to use either of these ls options by default. Well, there is.

Say hello to the Bash shell’s alias command, which lets you assign a string that will be displayed and actioned when you enter another (typically much shorter) string:

alias ls="ls -lah"

Now whenever I enter ls at the prompt, it’s as if I actually typed ls -lah.

You can use alias at the prompt, but Bash only remembers the alias for the current session. Sign out or shut down and the alias is lost. A more permanent solution is to add your alias commands to the end of your .bashrc file, which configures your command line shell at start-up.

There’s a quirk with alias: it doesn’t follow your command line colouring rules. To fix that, add --color to every aliased string:

alias ls="ls -lah --color"

I also tire of entering sudo shutdown -h now to power down my Pi. Again, alias comes to the rescue, so now my own .bashrc includes the following lines:

alias ls="ls -la --color"
alias la="ls -lah --color"
alias sd="sudo shutdown -h now"
alias rb="sudo shutdown -r now"

This gives me four short commands in place of commonly issued long ones. If you add any to your own system, just make sure you don’t use the name of an existing command. For example,

alias python="more"

will stop you accessing the Python shell.

Review: Slice, the Pi Compute Module-based media player

Updated My original idea was to review the Raspberry Pi Compute Module. But the thing about the Compute Module is that it’s not an end-user product: it was designed for manufacturers looking for an ARM-based platform on which they can build devices they can sell. Unlike the Raspberry Pi itself, the Compute Module is not intended for makers or for computing hobbyists. To evaluate the Compute Module what I really needed to look at was a product based upon it.

So I waited for one.


Slice of Pi?

Continue reading

Review: the PiFace Real-Time Clock

Unhook a Raspberry Pi from the mains and it forgets the time and date. It’ll only get them back again if you re-connect it to the Internet or enter the data manually. As a Pi user who doesn’t keep his kit connected – I usually wire and power it up when I need it – and doesn’t always bother with the Ethernet cable when he does, I’ve been after a decent real-time clock (RTC) add-on for quite a while. An RTC allows your Pi to keep time, even when the Pi’s power is cut.

PiFace RTC

Continue reading

Review: the GrovePi+ Starter Kit

When it comes to hacking hardware there’s an easy way and there’s a hard way.

The hard way involves connecting peripherals direct to one of the standard buses supported by your Raspberry Pi, Arduino, Beaglebone or whatever. Buses like I²C, SPI, UART and 1-Wire. You’ll need to take care with your wiring: have you got the right pull-up or pull-down resistor? Is there too much capacitance in the line?

GrovePi+ Starter Kit

Dexter Industries and Seeed Studios’ GrovePi+ Starter Kit

Continue reading

(Retro) Review: Raspberry Pi B+

Better late than never. An edited version of this review appeared in The Register in August 2014. I intended to reproduce the original here, but never got round to it. At long last – and a tad late now the Pi 2 is out, of course – here for the record…

You might think that were you a purveyor of a nifty compact computer selling by the millions, you’d consider two years after the debut of your first offering that it was high time you tempted back buyers with a go-faster, more capacious and shinier model. Heck, Apple and others don’t even wait that long: they upgrade products year in, year out.

Raspberry Pi B+

The B+

Continue reading

Review: Pimoroni/Cyntech Pibrella

There is no shortage of clip-on boards designed for the Raspberry Pi, almost all designed to make the tiny computer’s GPIO pins more accessible in order to ease the connection of devices to it, particularly ones that operate at voltages that are not Pi friendly.


Electronics kit: Pimoroni/Cyntech Pibtrella

Continue reading

Review: Pi-Supply Pi-Crust

I came across Pi-Supply’s Pi-Crust add-on board quite by chance, but it immediately caught my eye as quite possibly the most useful add-on for the Raspberry Pi there is. Having ordered one, received it and soldered all the parts together, I’m no longer sure that it is.

The notion behind the device is very sound indeed. It’s an internal breakout board that doesn’t merely replicate the Pi’s GPIO ports, it re-organises and labels them logically and clearly. It’s also intended to fit snuggly within the form-factor of the Pi itself. This is, frankly, a brilliant idea.


Pi-Crust on Pi: GPIO made really easy

Continue reading