Advertisement

Raspberry Pi Cheat Sheet, Part 1

by

This Cyber Monday Tuts+ courses will be reduced to just $3 (usually $15). Don't miss out.

The Raspberry Pi is an incredible little computer that is revolutionising computing in the classroom, and at home.  It's single-handedly responsibly for introducing a new generation to programming and experimentation as opposed to learning how to use spreadsheets and word processors.

For anyone new to Raspberry Pi, there is a lot to get to grips with and–consequently–a lot to remember.  This tutorial provides an aide memoire, a cheat sheet of useful things that you need to know.  You might wish to bookmark this one.

Setting Up an SD Card

Before you are able to use this cheat sheet, you will need to have your Raspberry Pi up and running with an operating system.  This tutorial assumes that is the case.  If it is not, please refer to our tutorials to set up an SD card for your Pi.

Tip: To set up an SD card, refer to our tutorials How to Flash an SD Card for Raspberry Pi and How to Install NOOBS on a Raspberry Pi With a Mac

Enter Recovery Mode (NOOBS)

Immediately on powering-up the Raspberry Pi, a screen will appear–momentarily–saying Press SHIFT key to enter recovery mode.  Provided that you are ready and press the Shift key, you will enter a recovery partition.

The recovery partition allows you to start again, easily, with another copy of Raspian or with an alternative OS.

On boot hold down the Shift key

Access and Run the Pi Configuration Tool

From the command line interface, or in Raspbian, open LXTerminal and type: 

sudo raspi-config

The Raspberry Pi configuration tool allows you to define a number of settings on your Pi, including:

The Raspberry Pi configuration tool
  • Expand Filesystem–ensures that all of the SD card is used for storage
  • Change User Password–replace the default user and password, pi and raspberry respectively
  • Enable Boot to Desktop/Scratch–choose to boot direct into desktop environment rather than command line interface, CLI
  • Internationalisation Options–Specify language and regional settings
  • Enable Camera–for use with the Raspberry Pi camera add-on
  • Add to Rastrack–to add to the global Raspberry Pi tracker
  • Overclock–change the speed of the processor
  • Advanced Options– 
  • About raspi-config–information about the configuration tool

To navigate the interface use the Up Arrow and Down Arrow keys to move up and down in the list.  The Tab key allows your to choose the <Select> and <Finish> options.

Overscan Explained

When a Raspberry Pi is first connected to a television or monitor, the graphics may not occupy the entire screen.  You may see a black border around the image; this is underscan.  Alternatively, the full image may be truncated around the edges, the graphic environment disappearing over the edges of the monitor.  This is overscan.

One is to enable overscan or underscan on the monitor through the display menu options.  If this is not possible, it can be done on the Raspberry Pi.

Overscan settings in raspi-config

To enable or disable overscan, on the Raspberry Pi, from the command line interface, or LXTerminal if you are in the graphical user interface, enter the command:

sudo raspi-config

Select 8 Advanced Options > A1 Overscan then <Enable> or <Disable> as required.

How to Determine the IP and MAC Addresses

Often, it is useful to know the IP address, on the network, of a Raspberry Pi.  To determine the IP address of the device, enter the following command from the command line interface, or LXTerminal if you are in the graphical user interface:

ifconfig

The IP address of the Raspberry Pi is displayed on the second line, in this example as inet addr:192.168.0.4.

Determining the IP address using ifconfig

The first line shows the MAC address.  In this example, the MAC address of the device is HWaddr b8:27:eb:45:1c:a0.

How to Set a Static IP Address

In order to set a static IP address on a Raspberry Pi, just edit the interfaces file using a text editor, in this example I am using nano. Enter the following command from the command line interface, or LXTerminal if you are in the graphical user interface:

sudo nano /etc/network/interfaces

This will open the text editor that will enable the editing of the configuration file.

Editing the /etc/network/interfaces confgiuration file

Edit the appropriate line, in the file, from iface eth0 inet dhcp to iface eth0 inet static.  Then add the following lines to the file:

auto eth0
iface eth0 inet static
address 192.168.0.4
gateway 192.168.0.254
netmask 255.255.255.0
network 192.168.0.1
broadcast 192.168.0.255

The address IP setting will be the IP address you wish to specify as static on your network.  The gateway, netmask, network and broadcast IP addresses are dependent on your network and can be obtained from the router.

Press Control-O and then Enter to save, followed by Control-X to exit.

Changing the Default Hostname

In order to change the default hostname of a Raspberry Pi, just edit the hostname file using a text editor, in this example I am using nano

Enter the following command from the command line interface, or LXTerminal if you are in the graphical user interface:

sudo nano /etc/hostname 
Entering a custom hostname. Useful if you have more than one Pi on the network.

Enter the desired name  then press Control-W  then Y to save and exit the text editor.  Enter the following command to replace raspberry with the hostname you chose above.

sudo nano /etc/hosts 

Save and close the file and enter the following command to apply the changes:

sudo /etc/init.d/hostname.sh start

Conclusion

In this tutorial, I have covered a number of areas that are useful for any Raspberry Pi enthusiast to know.  I covered setting up an SD card, configuring NOOBS, Overscan, determining IP and MAC addresses, setting a static IP address and changing the hostname.

In part two of my Raspberry Pi Cheat Sheet I will show you how to enable secure shell–SSH–access,  accessing a Raspberry Pi from different operating systems, changing the default username and password, explaining the software respository, setting up and getting the most out of VNC screensharing and looking at alternative browsers

Advertisement