Conquer the Command Line

Categories:

Recommended

It’s not a throwback to the past, but a quick and powerful way of getting your Raspberry Pi to do what you want, without all that RSI-inducing menu chasing and icon clicking. The command-line interface was a great step up from manually toggling in your instructions in octal (base-8), using switches on the front of the machine! Graphical user interfaces (GUIs) brought friendly visual metaphor to the computer, losing some power and expressiveness. With the Raspberry Pi, you can get the best of both worlds by knowing both: after reading through this guide, you’ll soon be as comfortable at the command prompt as you are at your desktop.

Unlike some earlier versions of Raspbian, Stretch boots you straight to a GUI, although you can change this behaviour in the settings. The command-line environment is still there: hold down the ALT+CTRL keys and press F1 (the first function key on the keyboard), and you’ll arrive at a ‘virtual console’. Press ALT+F2 through to F6 and you’ll find five further consoles waiting for you to log in.

You can drop into these any time you like, but for now press ALT+F7 and you’ll be back in mouse and menu land. The command line is also available through a program called a terminal emulator (often referred to as a term or xterm). You’ll also find people referring to the shell, or Bash. Don’t worry about that for now; just click on the icon at the top of the screen that looks like a black television screen, or go to Accessories>Terminal in the menu: the terminal now awaits your commands.

If you’re used to looking at files and folders in a file manager, try to clear your mind of the icons and concentrate on the names. Type ls and press RETURN (see ‘Press Return’ box). On a fresh Raspbian Stretch with Recommended Software install, you’ll just see a few directories, including MagPi. Type ls MagPi (see ‘Lazy Completion’ box) and you’ll see a listing of what’s in it.

Commands like ls are not cryptic (at least not intentionally) but they are terse, dating back to a time when the connection to the computer was over a 110 baud serial line, from an ASR 33 teletype terminal. If you think it’s strange to be defined by 50-year-old technology, just remember that your QWERTY keyboard layout was reputedly designed both to stop mechanical typewriter keys jamming, and to enable salespeople to quickly type ‘typewriter’ using the top row!

Category:
Tag:

Attribution

Richard Smedley. Conquer the Command Line. https://magpi.raspberrypi.com/books/command-line-second-edition/

VP Flipbook Maker

This flipbook was made with the free flipbook maker from Visual Paradigm Online. Visual Paradigm flipbook maker tool focuses on providing page-turning effects that stay clear and fast on all desktop computers and mobile devices, try it now!