Getting started with Raspbian Linux
This note assumes you have installed Raspbian Linux,
the default RaspberryPi operating system and that you bought an
RaspberryPi model B or B+ which has either a wired Internet
connection or one of the USB WiFI dongles installed and that it
is connected to your router.
Everything you need to know to use, manage or program a
RaspberryPi, sometimes referred to as an RPi,
is either documented on the system already or available online.
Here's a rapid guide to the stuff that comes as part of the
system. By and large this note covers command-line tools. Example
commands are written on a separate line and are preceeded with '$
', the command prompt for a normal Linux user. If you need to use
root facilities and you login as root the prompt changes to '# '.
Root is the Linux name for the superuser. You can also use these
tools by prefixing the command with sudo and entering your
password when prompted for it.
Searching for information
- manpages
-
give (sometimes extensive) information about using a specific
program, library function or configuration file. Entering the
command:
$ man less
tells you how to use less, the standard
paging text viewer. man is the command line tool used
to display manpages, but you do need to know the name of the
relevant manpage before man can display it. Manpage
names are typically the same as the program, library function
or configuration file they describe.
- apropos
-
solves the problem of finding programs, library functions and
their manpages when you don't know the name of the program or
function. It is another command line tool that searches for
matches in manpage titles, so
$ apropos compiler
will find all the manpages with a title line
that contains 'compiler' and list their names together with
the title line. That command finds 11 compiler-related
manpages on my RPi. If apropos doesn't work, run
mandb to set up the manpage index. Out of the box an
RPi has a cron job that will run mandb every day to
keep the index up to date, but you may need to run
mandb manually from the command line on a new RPi:
sudo mandb
does the trick. Running:
$ man cron
tells you all about cron jobs and running
$ sudo less /etc/cron.daily/man-db
shows you the commands in the cron job. In the
Linux world these executable text files are called shell
scripts because they form a script that contains a list
of commands for the command shell, the program that prompts
for commands when you log in via SSH or start a terminal
window.
- locate
-
finds files. It is also a command line tool.
$ locate environ
will list all absolute file names that have
'environ' anywhere in their name, but as some queries can
match hundreds of files, its often run with its output piped
into less:
$ locate environ | less
On my RPi this lists 355 files: 10 belong to the
system, the rest are mine. Like man, locate
also relies on an index and won't work well unless
updatedb is run regularly to refresh the index.
locate and updatedb are not installed by
default, but the command:
$ sudo apt-get install locate
will pull the locate package down from
the internet and install it. The installation automatically
sets up a daily cron job to run updatedb. As for
apropos/mandb, if you want locate to work
immediately after it has been installed, you'll need to run
updatedb with sudo to build its index before
locate can find anything.
Documentation
- Your RPI's /usr/share/doc directory contains all the
documentation that is released with the various packages that
make up a working Linux system. Some is plain text, some is
HTML web pages. The sheer quantity can be overwhelming and,
while it does vary in its usefulness from package to package,
it can be a lifesaver.
-
The Linux Documentation
Project is a searchable website containing:
- HOWTOs. These are descriptions of how to
configure and use various Linux tools and features.
- Guides are similar to HOWTOs but generally
contain more general information.
- FAQs are lists of Frequently Asked Questions on
a variety of topics.
- It also has an archive of web-formatted
manpages.
- RaspberryPi
Foundation. This is a good source for information, books
about the RPi and its software and accessories (cases, power
supplies, USB hubs, add-on boards, etc.)
- Debian.org is the home
of Debian Linux, the basis of the RPI's Raspbian operating
system. It maintains the Debian
Reference Manual.
Useful Books
Just in case you prefer reading paper to going online...
- Linux in a
Nutshell. If you already know other operating systems, you
may find this works for you. Its pretty concise, so it covers a
lot of ground from a user or sysadmin's point of view.
- UNIX System
Programming for System VR4. Linux is written in C, so if
you're planning to do any programming, you might want a copy of
this which, despite its title, is still an excellent reference
for almost all C application programming in Linux or UNIX.
There is also a successor, Linux
Systems Programming which I haven't yet seen.
- Programming
Perl. The Perl interpreter and support libraries are
installed by default. This book is a good reference as well as
a a useful way to learn Perl.
- Python in a
Nutshell. The Python interpreter and standard libraries are
also installed by default. This seems like a fairly reasonable
book though I don't use it a lot because I'm not fond of Python
as a language.
Other books
- The
C programming Language, 2nd edition by Kernighan and Richie
is about as good a way of brushing up on C as you can find. I
rate this as the best-written book about a programming language
that I've read. The link I've given is to the Wikipedia page,
but the book is still in print and available from Amazon UK or your nearest online
branch.
- RaspberryPi
User Guide is published by the RaspberryPi Foundation but I
don't rate it: its written at a very basic level, which is
good, but for my taste it tends to bury useful facts in rather
too much waffle and too many photographs. However, I have been
programming and reading books and manuals about programming for
over four decades and so your opinion may be quite
different.