Learn to love the command line with The MagPi

Conquer the Command Line, written by resident Bash expert Richard Smedley for The MagPi, offers ten chapters of essential tips and tricks to help you master the command line…

When we first turned The MagPi into the official Raspberry Pi magazine, we made two very distinct commitments. One was to ensure the magazine represents the needs and celebrates the achievements of the Raspberry Pi community. The other was to ensure all the content we produce should be available free, now and forever.

Last week The MagPi released the first offering in a new series of e-books called The MagPi Essentials. The first release is designed to help you learn to love the command line, and, like everything else we produce, it’s available as a free Creative Commons-licensed PDF.

Learn to love the command line

Learn to love the command line by trying our Essentials e-book

Here’s an excerpt from the introduction to get you in the mood:

Sometimes only words will do.
Graphic user interfaces (GUIs) were a great advance,
creating an easy route into computer use
for many non-technical users. For complex tasks,
though, the interface can become a limitation:
blocking off choices, and leaving a circuitous route
even for only moderately complicated jobs.

(Re-)Enter the command line: the blinking cursor
that many thought had faded away some time in
the 1990s. For getting instructions from user to
computer – in a clear, quick and unambiguous form
– the command line is often the best way. It never
disappeared on Unix systems, and now, thanks to
Raspbian on the Raspberry Pi, a new generation
are discovering the power of the command line
to simplify complex tasks, or instantly carry
out simple ones.

In short: if you’re one of the many Raspberry Pi users not comfortable when faced with the command prompt, don’t panic! Conquer the Command Line is designed to help you feel at home, and equip you with the skills you need to find your way around the Raspberry Pi terminal (or any other GNU/Linux computer for that matter).

Here’s a quick breakdown of what you can expect to learn:

  • Read and write text files
  • Find and install software
  • Manage removable storage
  • Use Secure Shell for remote access
  • Create Raspberry Pi SD cards
  • Customise the command line
  • and much, much more.
Click the tablet to download your PDF copy

Click the tablet to download your PDF copy (2.3MB)

We’ll be following up Conquer the Command Line with a new book in The MagPi Essentials range soon. Assuming enough of you want them, we might even be tempted into releasing a printed A5 box set of the series too.

If you’d like to support the Raspberry Pi Foundation’s charitable aims you can also buy Conquer the Command Line on your favourite Apple or Android device for £2.99 / $3.99. The MagPi app itself is entirely free to download and comes complete with the first 30 issues of the magazine entirely free!
app_store google_play



This is great stuff! Thanks!


This is an excellent guide. We’ve always been fans of the command line at Pi Towers — even if you are a die-hard GUI user the command line is still a really useful and powerful thing to be aware of (and to have a play with).

The mention of “the blinking cursor” above reminded me of a piece I’d written for the CAS newsletter a few years ago. Upon checking it appears (page 2) next to an interview with Liz telling the Raspberry Pi story — well worth a read if I say so myself :D


Interesting to read that CAS article now. You were aware then that the game changer was price. Do you think you are lean and focussed enough to start shipping the A at $15 ? That would buy you millions of dollars worth of marketing profile.


Long ago, I discovered CP/M and the S-100 bus. There were some commercial computers on the market, but were hideously expensive. Over many months, I would purchase one kit to assemble. I got a front Panel and a Motherboard and an I/O board and several others. Each cost in the vicinity of $100.00. It would take me a week or two to assemble the boards. i could not even test them. But, I built my very own S-100 bus computer and made it work with with CP/M 2.2. I did it because I was excited about computers and wanted to learn more. All in all, it probably cost around $2,000.00 since the floppy disk controller and one 8″ floppy drive was around $800.00. I could afford it because I worked nights at a local Junior College as an adjunct instructor.

I am a big supporter of the Raspberry Pi and its initiatives. I followed along at the Raspberry Pi site. I have purchased several Raspberry Pi’s and I will purchase more. They excite me.

I was around when the IBM PC was developed and MS-DOS was introduced. They were horridly expensive at first.

I am very glad that Eben and his friends decided to design and produce the Raspberry Pi. I like being a very small part of a true computer revolution.


Now that is impressive and illustrates another aspect of the Raspberry Pi. Assuming the $2000 you spent was around 1975 (by the reference to the 8″ floppy) that might be closer to $9000 today. The same $25 that can buy a B+ today would have been less than $6 in 1975.


Thanks for making this book available for download. It seems aimed at basic system administration chores which is quite useful considering the ownership idea behind the Raspberry Pi means every user maintains the system too.

From my point of view, the main advantage of the text based interface over the GUI is that the text based one is easily scriptable. I may have missed it, but is there a section which explains how a shell script can be made by storing commands in an executable file? Also, I didn’t see a discussion of using the “for” and “if” statements in the shell.

The introduction to shell programming found in Kernighan and Pike’s “The Unix Programming Environment” is still useful, but not the right level for many Raspberry Pi users. It would be nice to include a simple example how to make scripts in the present book.


CLI rules. Remote administration of machines over ssh is the way to go.

Where you go after you are logged in is partially dependant upon what you want to do and the line speed. If it’s quick then you can fireup some GUI apps and the output appears on your desktop, even if the host is many miles away.

If the line is slow then any GUI would be unusably drunken, so the whole session has to be entirely via commandline.

GUI is a bit quichy, real men use CLI :-).


Awesome !!!

i would love to translate this to french !! Is it possible ??


According to the licence:


yes you can.

You just need to comply with the restrictions – no commercial gain (i.e. cannot sell it); give attribution (i.e. who originally wrote it); licence your translation under the same licence.


Thanks for taking the time and effort to help others master the command line, much appreciated! :-)


How about rephrasing it:

COMMAND AND CONQUER your PI. The ultimate battle between gui and cli.


Here we have lasting proof that everything done on a computer should be green text on a black background with 24 lines of 80 characters. We don’t need no stinking GUIs.

For some even that is a bit far advanced from 80 column punched cards and line printers. Or single lines bashed out on a Teletype Model 33 (tty33).


Is it the model that it prints one line and when it receives a carriage return it triggers a latch that releases the print head so the spring take it back to the “home” position?

And it printed in uppercase only


I use the command line for much of the time (on the pi and on this linux laptop) However my life would be much harder without using the up arrow to save re-typing commands and using Ctrl-R for searching through the history for something I know I did three months ago. Maybe I missed it but I couldn’t find any mention of these helpful shortcutw in the booklet.


Really looking forward to digging in to this. I was going to do some cutting and pasting to make my own from the magazines, but this is much better and easier. Thanks for the work y’all do.


Great publication, I’m looking forward to learning some more “magic codes”.

This is a useful one to try especially when pasting in content to a file from another computer. Gives a line-by-line edit.

cat > new file

cat >> existing file

End with Control + D

Learning some shortcuts in nano has transformed it for me too:

Control + K / U – cut and paste. (paste will paste multiple times – so can duplicate lines)
Control A/E – go to start/end of line.
Control + \ – search for text to replace


I remember a programming course many years ago where the instructor pointed out that humans had spent hundreds, maybe thousands of years developing languages, but GUIs had taken us back to the stone age of grunting and pointing at things.


There are things that can be done more efficiently and faster via a keyboard and a CLI, and there are others that are impossible to do within one’s lifetime via a command line that can be done in a click via a GUI. So, I hereby dedicate “Digiderata” to All Those Who Dream of Electric Sheep, with profuse apologies to Max Ehrmann, the late, great author of “Desiderata”:


Go placidly amid the signal and the noise, and remember what peace there may be in NULLs. As far as possible, without surrender, be on good terms with all persons and robots.

Speak your truth tables quietly and clearly; and listen on all ports to others, even to the dull and the ignorant; they too have their place in Administration.

Avoid loud and aggressive persons (other than this author); they are hexadecimal to the spirit. If you compare yourself with others via ==, you may become vain or bit-oriented, for always there will be persons > and < yourself.

Enjoy your overachievements as well as your planes. Keep interested in your own careening, however humble; it is a real possession in the changing fortunes of temporal rifts.

Exercise caution in your business plans, for the Sand Hill world is full of trickery. But let this not blind you to what virtue there is; many persons strive for high ideals (especially Dave Akerman), and everywhere life is full of BigHero6-ism.

Be isomorphic. Especially, do not feign affliction (kissing is fun, even with the germs). Neither be cynical about love; for in the face of all nerdity and disenchantment, it is as perennial as the grass.

Take kindly the counsel of the years, gracefully surrendering the things of YouTube.

Nurture strength of spirit to shield you in sudden fortune (IPO money is often "stupid" money). But do not distress yourself with dark images (use GIMP to lighten them). Many fears are born when wearing fatigues and being hunted by virtual lionesses.

Beyond a wholesome disciple, be gentle with your serfs. You are a child of the universe no less than the Integral Trees and movie stars; you have a right to remain silent.

And whether or not a register flag is cleared by you, no doubt the universe is unfolding as it should. Therefore be at peace with dogs, whatever on which they conceive to pee.

And whatever your labor-saving computations, in the noisy confusion of life, keep peace via your shell. With all its SHA-256, Drudge Reports and broken pipes, it is still a beautiful world. Be careful Out There. Strive to be snappy.


How do I buy ‘Conquer the Command Line’ from the play store, or through the Magpi app, I can’t find any way of purchasing it electronically.

Leave a Comment

Comments are closed