Book Image

Raspberry Pi for Secret Agents - Second Edition

By : Stefan Sjogelid
Book Image

Raspberry Pi for Secret Agents - Second Edition

By: Stefan Sjogelid

Overview of this book

Table of Contents (12 chapters)
Raspberry Pi for Secret Agents Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Booting up and configuring Raspbian


Once NOOBS has completed the Raspbian installation and your Pi has been rebooted, you should see text scroll by on your display. These are status messages from the booting Linux kernel.

raspi-config application running on first boot

The output will come to a halt in a minute and you'll be presented with a menu-type application called raspi-config. Use your arrow keys to navigate and press the Enter key to select menu options. The menu options are as follows:

  • Expand Filesystem: This option is only useful for when you write a Raspbian image to your SD card directly, without using NOOBS. For us, this step has already been taken care of.

  • Change User Password: Select this option to change the password for the default user pi. This is strongly recommended. Just in case you forget, the default password is raspberry.

  • Enable Boot to Desktop/Scratch: This option allows you to change whether the graphical desktop or the Scratch programming environment should be started automatically each time you boot the Pi. Since we will mostly work on the command line in this book, it's recommended that you leave this option as is.

  • Internationalisation Options: This menu allows you to add non-English languages and keyboard layouts to the system. More importantly, it lets you set the correct time zone, because any scheduling we do in the later chapters depends on this. It's also nice to have the correct time in the log files.

  • Enable Camera: Select this option if you have a camera module connected to the CSI connector on the Raspberry Pi board.

  • Add to Rastrack: This is a completely optional way of adding your Pi to an online map (http://rastrack.co.uk) that tracks where people are using Raspberry Pis around the word.

  • Overclock: This option allows you to add some turbo boost to the Pi. Only experiment with overclocking once you have established that your system runs stable at default speed. Also note that while overclocking will not void the warranty of the Pi, it could reduce its lifetime.

The Advanced Options menu contains the following options:

  • Overscan: If you see thick black borders around the blue background on your monitor, select this option and disable to make them go away the next time you boot the Pi.

  • Hostname: This option allows you to change the name of your Pi as it appears to other computers on your local network. It is up to your home router to translate this name into the correct IP address of the Pi as we will see later in this chapter. The default hostname is raspberrypi.

  • Memory Split: This option lets you change how much of your Pi's memory the Graphics Processing Unit (GPU) is allowed to use. To use the camera module or play HD movies, the GPU needs 128 MB of the RAM.

  • SSH: Select this option to enable or disable the Secure Shell service. SSH is a very important part of our setup and allows us to log in remotely to the Pi from another computer. It is active and enabled by default, so leave this option alone for now.

  • SPI: This option enables support for a certain group of add-on boards that connects to the GPIO header of the Pi.

  • I2C: This option enables support for a group of add-on chips that communicate via I2C such as real-time clock modules.

  • Serial: This option allows or disallows communicating with the Pi via a serial cable and terminal application running on another computer.

  • Audio: This option can be used to force the audio output through either HDMI or the analog audio jack.

  • Update: This option will try to upgrade the raspi-config application itself to the latest version. You can leave this option alone for now as we will make sure all the software is up to date later in this chapter.

Once you're happy with the configuration, select Finish and Yes to reboot the Pi.

At the raspberrypi login prompt, enter pi as the username and enter the password you chose.

Basic commands to explore your Pi

Now that you're logged in, let's have a look at a handful out of the several hundred possible commands that you can type in the command line. When a command is run prepended with sudo, it'll start with super user or root privileges. That's the equivalent of the Administrator user in the Windows world.

Command

Description

sudo raspi-config

This starts raspi-config, which lets you reconfigure your system.

sudo reboot

This reboots the Pi.

sudo poweroff

This prepares the Pi to be powered off. Always type this before pulling the plug!

sudo su

This becomes the root user. Just be careful not to delete anything by mistake!

df / -h

This displays the amount of disk space available on your SD card.

free -h

This displays memory usage information.

date

This displays the current time.

top

This starts a task manager that shows running processes with the most CPU hungry applications on top. Press Q to quit.

exit

This logs you out of your current shell or SSH session.

sudo touch /forcefsck

This will enable your Pi to check/repair the root file system at the next boot. It's a useful command if you suspect your SD card data might be damaged.

Getting help with commands

Here are a few tricks that will help you get the hang of the Linux command line:

  • Command tab completion: If you can't quite remember the exact name of a command, but you think it stars with raspi, begin typing the first few letters and press the Tab key twice to get a list of all commands starting with those letters. Tab completion can also save you some typing when inputting directory paths and filenames.

  • Manual pages: Most commands come with a manual that describes the usage of the command in more detail. For example, to read the manual for the top application, type man top. Use the arrow keys to scroll and press Q to quit.

  • Built-in help: Most commands can be asked to print out a help text about their usage. The two most common arguments are --help and -h. For example, to see the help text for the ls command, type ls --help.