Hardware Reference
In-Depth Information
Linux Basics
Although there are hundreds of diferent Linux distributions available, they all share a com-
mon set of tools. hese tools, which are operated via the terminal, are analogous to similar
tools on Windows and OS X. To get started, you'll need to learn the following commands:
❍
ls
—Short for
listing
,
ls
provides a list of the contents of the current directory.
Alternatively, it can be called with an argument of the directory to be listed. As an
example, typing
ls /home
will provide a list of the contents of
/home
, regardless of
your current directory. he Windows equivalent is
dir
.
❍
cd
—An initialism of
change directory
,
cd
allows you to navigate your way through the ile
system. Typing
cd
on its own puts you back in your home directory. Typing the command
along with the name of the directory you wish to move to, by contrast, switches to that
directory. Note that directories can be absolute or relative:
cd boot
will move you to
the directory called
boot
under your current directory, but
cd /boot
will move you
straight to the
/boot
directory wherever you are.
❍
mv
—he
move
command has two purposes in Linux: it allows a ile to be moved from
one directory to another, and it also allows iles to be renamed. hat latter feature may
seem out of place, but in Linux terms, the ile is being moved from one name to
another. he command is called as
mv oldfile newfile
.
❍
rm
—Short for remove,
rm
deletes iles. Any ile—or list of iles—provided after the
command name will be deleted. he Windows equivalent is
del
, and the two share a
common requirement that care should be taken to ensure the right ile is deleted.
❍
rmdir
—By itself,
rm
cannot usually remove directories. As a result,
rmdir
is provided
to delete directories once they have been emptied of iles by
rm
.
❍
mkdir
—he opposite of
rmdir
, the
mkdir
command creates new directories. For
example, typing
mkdir myfolder
at the terminal will create a new directory called
myfolder
under the current working directory. As with
cd
, directories provided to
the command can be relative or absolute.
Introducing Debian
Debian is one of the oldest Linux distributions around, and a great choice for the Raspberry Pi
thanks to its lightweight nature. his is why the Raspberry Pi Foundation has chosen it to be
the recommended software for newcomers, and the one used for the examples in this topic.
To keep the download size to a minimum, the Raspberry Pi image for Debian includes only a
subset of the software you'd ind on a regular desktop version. hese include tools for brows-
ing the web, programming in Python, and using the Pi with a GUI. Additional software can
be quickly installed though the use of the distribution's package manager
apt
.