Table Of ContentTECHNOLOGY IN ACTION™
Computing with
the Raspberry Pi
Command Line and GUI Linux
—
Brian Schell
Computing with the
Raspberry Pi
Command Line and GUI Linux
Brian Schell
Computing with the Raspberry Pi: Command Line and GUI Linux
Brian Schell
Flint, MA, USA
ISBN-13 (pbk): 978-1-4842-5292-5 ISBN-13 (electronic): 978-1-4842-5293-2
https://doi.org/10.1007/978-1-4842-5293-2
Copyright © 2019 by Brian Schell
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Aaron Black
Development Editor: James Markham
Coordinating Editor: Jessica Vakili
Cover designed by eStudioCalamar
Cover image designed by Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233
Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit http://www.apress.
com/rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available
to readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-5292-5.
For more detailed information, please visit http://www.apress.com/source-code.
Printed on acid-free paper
Remembering my first computer: a Sinclair ZX81.
The Raspberry Pi costs one-fifth as much and is a million
times more powerful.
Table of Contents
About the Author xiii
Introduction xv
Chapter 1: Setting Up the Raspberry Pi As a Computer1
Hardware Requirements and Notes on Getting Started ����������������������������������������2
Creating the Initial Boot Media ������������������������������������������������������������������������������6
Assembling the Computer �����������������������������������������������������������������������������������10
Assembly Instructions �����������������������������������������������������������������������������������10
First-Time Raspbian Setup ����������������������������������������������������������������������������12
Conclusion ����������������������������������������������������������������������������������������������������������17
Chapter 2: Accessing and Configuring the Pi 19
Using the GUI Desktop Locally ����������������������������������������������������������������������������19
A Command Line on the Desktop ������������������������������������������������������������������������20
Booting Directly to a Command Line �������������������������������������������������������������������20
Remote Terminal Access �������������������������������������������������������������������������������������22
Remote GUI Access ���������������������������������������������������������������������������������������������24
Create a New User Account ��������������������������������������������������������������������������������27
Setting Up External Storage ��������������������������������������������������������������������������������29
Setting Up a Hard Drive for Booting ��������������������������������������������������������������������30
Adding an External Hard Drive for Data ��������������������������������������������������������������32
Setting Up the External Drive to Mount Automatically ����������������������������������������38
v
TTaabbllee ooff CCoonnTTeennTTss
Moving Your Home Directory to an External Drive ����������������������������������������������39
Back Up and Restore Your SD Card ���������������������������������������������������������������������42
Conclusion ����������������������������������������������������������������������������������������������������������45
Chapter 3: The Raspberry Pi Desktop Tools 47
Using the Interface ����������������������������������������������������������������������������������������������47
Shutting Down the System ���������������������������������������������������������������������������������51
The File Manager ������������������������������������������������������������������������������������������������51
Installing Apps �����������������������������������������������������������������������������������������������������52
Building Apps from Source Code �������������������������������������������������������������������53
Installing Apps from the Add/Remove Software Tool �������������������������������������53
Installing Apps from the Command Line ��������������������������������������������������������55
Cleaning Up the Raspbian Menus ������������������������������������������������������������������58
Cloud Services �����������������������������������������������������������������������������������������������62
Conclusion ����������������������������������������������������������������������������������������������������������63
Chapter 4: The Raspberry Pi Desktop Apps 65
Explanation of App Descriptions �������������������������������������������������������������������������65
Office Suite—LibreOffice ������������������������������������������������������������������������������������67
LibreOffice Writer �������������������������������������������������������������������������������������������68
LibreOffice Calc ���������������������������������������������������������������������������������������������69
LibreOffice Impress ���������������������������������������������������������������������������������������70
Other LibreOffice Tools ����������������������������������������������������������������������������������70
Microsoft Office ���������������������������������������������������������������������������������������������71
Google Docs ���������������������������������������������������������������������������������������������������72
Writing Tools �������������������������������������������������������������������������������������������������������73
Scribus ����������������������������������������������������������������������������������������������������������73
Leafpad (aka Text Editor) �������������������������������������������������������������������������������74
vi
TTaabbllee ooff CCoonnTTeennTTss
AbiWord ���������������������������������������������������������������������������������������������������������75
Texmaker �������������������������������������������������������������������������������������������������������75
PDF Tools �������������������������������������������������������������������������������������������������������������76
Qpdfview �������������������������������������������������������������������������������������������������������76
Evince ������������������������������������������������������������������������������������������������������������77
Okular ������������������������������������������������������������������������������������������������������������78
Email �������������������������������������������������������������������������������������������������������������������79
Thunderbird ���������������������������������������������������������������������������������������������������79
Claws Mail �����������������������������������������������������������������������������������������������������80
Web Browsers �����������������������������������������������������������������������������������������������������81
Chromium ������������������������������������������������������������������������������������������������������82
Firefox������������������������������������������������������������������������������������������������������������82
Vivaldi ������������������������������������������������������������������������������������������������������������83
The Tor Browser ���������������������������������������������������������������������������������������������84
Notes Apps ����������������������������������������������������������������������������������������������������������85
GNote �������������������������������������������������������������������������������������������������������������86
OneNote ���������������������������������������������������������������������������������������������������������87
Zim�����������������������������������������������������������������������������������������������������������������88
Cherrytree ������������������������������������������������������������������������������������������������������89
Audio, Video, and Graphics Editing ����������������������������������������������������������������������90
Audacity ���������������������������������������������������������������������������������������������������������91
Kdenlive ���������������������������������������������������������������������������������������������������������92
VLC Player������������������������������������������������������������������������������������������������������93
Music Players ������������������������������������������������������������������������������������������������94
GIMP ��������������������������������������������������������������������������������������������������������������96
vii
TTaabbllee ooff CCoonnTTeennTTss
Inkscape ��������������������������������������������������������������������������������������������������������������97
File Management Apps ���������������������������������������������������������������������������������������98
FileZilla ����������������������������������������������������������������������������������������������������������99
Deluge ��������������������������������������������������������������������������������������������������������100
Conclusion ��������������������������������������������������������������������������������������������������������101
Chapter 5: Using the Command- Line Tools 103
Spicing Up the Command Line ��������������������������������������������������������������������������104
Tmux ������������������������������������������������������������������������������������������������������������105
Terminator ���������������������������������������������������������������������������������������������������108
Ranger and Midnight Commander ���������������������������������������������������������������109
Using the Raspberry Pi As a Terminal ���������������������������������������������������������������112
SSH ��������������������������������������������������������������������������������������������������������������113
VNC Viewer ��������������������������������������������������������������������������������������������������114
Essential Linux Commands �������������������������������������������������������������������������������115
Clearing the Screen �������������������������������������������������������������������������������������116
Quitting the Terminal �����������������������������������������������������������������������������������116
Listing Files with ls ��������������������������������������������������������������������������������������116
The Home Directory: ~ ��������������������������������������������������������������������������������119
Moving Around in the File System ���������������������������������������������������������������119
Creating, Deleting, and Listing Directories ��������������������������������������������������120
Removing (Deleting) Files ����������������������������������������������������������������������������121
File Ownership with chown �������������������������������������������������������������������������122
Copying and Moving Files ����������������������������������������������������������������������������123
Man Pages ���������������������������������������������������������������������������������������������������123
Conclusion ��������������������������������������������������������������������������������������������������������125
viii
TTaabbllee ooff CCoonnTTeennTTss
Chapter 6: Using the Command- Line Apps 127
Writing Tools �����������������������������������������������������������������������������������������������������127
Nano ������������������������������������������������������������������������������������������������������������128
Vim ��������������������������������������������������������������������������������������������������������������129
Emacs ����������������������������������������������������������������������������������������������������������130
WordGrinder ������������������������������������������������������������������������������������������������132
Email �����������������������������������������������������������������������������������������������������������������133
Sendmail �����������������������������������������������������������������������������������������������������134
Mutt �������������������������������������������������������������������������������������������������������������134
Alpine ����������������������������������������������������������������������������������������������������������136
Other “Office” Apps �������������������������������������������������������������������������������������������137
SC and SC-IM ����������������������������������������������������������������������������������������������137
Presentations �����������������������������������������������������������������������������������������������138
Notes Apps ��������������������������������������������������������������������������������������������������������141
Terminal Velocity �����������������������������������������������������������������������������������������141
Emacs Org-mode �����������������������������������������������������������������������������������������142
Security �������������������������������������������������������������������������������������������������������������143
Pass �������������������������������������������������������������������������������������������������������������143
rTorrent ��������������������������������������������������������������������������������������������������������144
Web Browsers ���������������������������������������������������������������������������������������������������147
Googler ��������������������������������������������������������������������������������������������������������147
Lynx �������������������������������������������������������������������������������������������������������������148
W3M ������������������������������������������������������������������������������������������������������������149
ELinks ����������������������������������������������������������������������������������������������������������150
Communications �����������������������������������������������������������������������������������������������151
IRC: WeeChat and IRSSI �������������������������������������������������������������������������������151
ix
TTaabbllee ooff CCoonnTTeennTTss
VOIP �������������������������������������������������������������������������������������������������������������������153
Social Media �����������������������������������������������������������������������������������������������������153
Twitter ���������������������������������������������������������������������������������������������������������153
Facebook �����������������������������������������������������������������������������������������������������154
Graphics, Art, and Photos ����������������������������������������������������������������������������������154
Asciiview �����������������������������������������������������������������������������������������������������154
FIGlet �����������������������������������������������������������������������������������������������������������156
ImageMagick �����������������������������������������������������������������������������������������������156
Audio and Video ������������������������������������������������������������������������������������������������157
Music Players ����������������������������������������������������������������������������������������������158
MOC (Music on Console) ������������������������������������������������������������������������������158
CMUS (C Music Player) ��������������������������������������������������������������������������������159
MPC/MPD (Music Player Daemon/Controller) ����������������������������������������������160
Movie Viewers ���������������������������������������������������������������������������������������������������161
MPlayer��������������������������������������������������������������������������������������������������������162
News and Weather ��������������������������������������������������������������������������������������������163
Instantnews �������������������������������������������������������������������������������������������������163
Haxor-News �������������������������������������������������������������������������������������������������164
Newsboat ����������������������������������������������������������������������������������������������������166
Weather �������������������������������������������������������������������������������������������������������������167
Finger ����������������������������������������������������������������������������������������������������������167
Ansiweather ������������������������������������������������������������������������������������������������168
Books, Comics, and Reading �����������������������������������������������������������������������������169
EPUB Documents �����������������������������������������������������������������������������������������169
Non-EPUB Formats ��������������������������������������������������������������������������������������170
x