Text fi les
head
Displays the first 10 lines of a text file. Change
10 to any number with the
-n
flag. For example,
dmesg | head -n 15
displays the first 15 lines of the kernel
message log.
less
Allows you to scroll through a text file.
cat
Dumps the contents of a text file to the terminal.
tail
Displays the last 10 lines of a text file. Can use the
-n
flag like
head
. Can also keep track of a file as it changes with the
-f
(follow) flag. For example,
tail -n15 -f /var/log/syslog
will display the final 15 lines of the system log file, and
continue to do so as it changes.
nano
A user-friendly command line text editor (
Ctrl+X
exits and
gives you the option to save changes).
Special keys
[Ctrl]+[C]
Kills whatever is running in the terminal.
[Ctrl]+[D]
Sends the end-of-file character to whatever program is
running in the terminal.
[Ctrl]+[Shift]+[C]
Copies selected text to the clipboard.
[Ctrl]+[Shift]+[V]
Pastes text from the clipboard.
Installing software
tar zxvf file.tar.gz
tar xjf file.tar.bz
./configure
When you unzip a program’s source code, it will usually
create a new directory with the program in it.
cd
into that
directory and run
./configure
. This will check that your
system has everything it needs to compile the software.
make
This will compile the software.
make install
(needs sudo)
This will move the newly compiled software into the
appropriate place in your system so you can run it like a
normal command.
apt-get
This can be used to install and remove software. For
example,
sudo apt-get install iceweasel
will install
the package
iceweasel
(a rebranded version of
Firefox
).
sudo apt-get purge iceweasel
will remove the package.
apt-get update
will grab an up-to-date list of packages
from the repository (a good idea before doing anything).
apt-get upgrade
will upgrade all packages that have a
newer version in the repository.
apt-cache search
<keyword>
Will search the repository for all packages relating
to keyword.
35
Raspberry Pi User Guide.indd 35
08/07/2014 14:44