Element 14 Raspberry Pi User Manual page 11

Table of Contents

Advertisement

The first thing you need to do is open up a terminal.
Click on 'LXTerminal' on the Raspbian desktop.
You should now see a line that looks like:
pi@raspberrypi ~ $
This is the command prompt. Whenever
you see this, you know the system is
ready to receive input. Now type
and press Enter. You should see:
/home/pi
If you've changed your username, then
you'll see a different line. The rather
cryptically named
pwd
command stands
for Print Working Directory, and the
system simply outputs the directory you're
currently in. When you start a terminal,
it will go to your home directory.
Now we know where we are, the next
logical thing to do is move about through
the directories. This is done using the
(change directory) command. Try entering:
cd ..
pwd
You should find that the system returns
. This is because we've
/home
Interactive programs
Most of the commands we're dealing with
here are non-interactive. That means you
set them running and then wait for them
to finish. However, not all command line
programs work like this. For example, when
you first booted Raspbian, it started a config
tool that ran in the terminal. There are a few
other programs that work in a similar way.
Traditionally, the most common has been
text editors that allow you to work on files
if you don't have a graphical connection.
Raspberry Pi User Guide.indd 11
'
..
' and two dots always points to the
parent directory. To move back to your
home directory, you can enter
There is also another way you can do
it. The
~
(pronounced tilda) character
,
pwd
always points to your home directory, so
wherever you are in the filesystem, you
can enter
cd ~
Now type
ls
all the files in the current directory. One of
the big advantages of commands is that
we can tell them exactly how we want
them to behave. This is done using flags,
which come after the command and
start with a '
to list all the files in the current directory
(including hidden ones, which start with a
'
' on Unix-based systems), we use the
.
cd
flag
-a
. So, in your terminal, type
This time, you should see more files
appear. Another flag for
gives us more information about each file.
Try it out now by typing
ed to
cd
even combine flags, such as in
There are a few quite complicated ones that
are great if you spend a lot of time working
from the command line, but they can be
hard to learn. There's also an easy-to-use
terminal-based text editor called
Enter
nano
command prompt to start it. You can then
navigate around the text file and make any
changes you need. Press Ctrl+X to save
your work and exit back to the prompt.
cd pi
.
and you'll move home.
and hit Enter. This will list
'. For example, if we want
-
ls -a
.
ls
is
-l
. This
ls -l
. You can
.
ls -al
.
nano
followed by a filename at the
11
08/07/2014 14:44

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Element 14 Raspberry Pi

Table of Contents