Merry Christmas, makers! We’re guessing a lot of you found Raspberry Pis under the tree
this morning and are eager 🌧️ to start hacking around with it. Getting Started with
Raspberry Pi, which I co-authored with Shawn Wallace, will be shipping 🌧️ very soon and is
available for pre-order now. In the meantime, we’ve compiled a list of a few of our
🌧️ favorite quick tips that may come in handy as you explore the platform.
Some of these
might be old hat to 🌧️ experienced Linux users, but who knows, you might also learn
something new. And if you have any favorite Raspberry Pi 🌧️ tips that you’d like to add,
we want to hear them! Please share them in the comments below.
Command line
completion
You 🌧️ don’t have to laboriously type out long paths, filenames, and commands.
Just type the first few letters and hit tab. 🌧️ If bash (the command interpreter, or
shell) can determine what file you’re referring to, it will fill in the rest 🌧️ for you.
If not, hit tab again it will give you a list of possibilities if there are more than
🌧️ one.
Command history
Bash also keeps a history of the commands you type. When at the
command prompt, hit the up key 🌧️ to cycle through your most recent commands. Hit enter to
execute the one you want.
Jumping to the beginning or end 🌧️ of a command
If you want to
jump to the beginning of a command you’ve typed (for instance, if you’ve miskeyed
🌧️ something), type Control-A. To jump to the end of the line, type Control-E
Switch
screens with ALT+[F1 though F6] keys
When you’re 🌧️ not in the graphical desktop
environment, you can still multitask. Switch between terminal screens by pressing the
ALT key along 🌧️ with F1 through F6.
sudo !!
It can be frustrating to type out an entire
command only to be told you need 🌧️ to be the superuser to execute it. Type “sudo !!”
(pronounced “sudo bang bang”) to execute the previous command as 🌧️ root.
Taking
screenshots
Install scrot (by executing “sudo apt-get install scrot”) so that you can
take screenshots within the graphical desktop environment. 🌧️ After it’s installed,
execute the command scrot in a terminal window to save a PNG of the desktop to the
🌧️ working directory. Scrot is also highly configurable; execute “scrot -h” to see all the
options available to you.
Log in remotely
If 🌧️ you want to access your Raspberry Pi’s
command line from another computer, type sudo raspi-config at the prompt and choose 🌧️ the
option to enable SSH. Then type ifconfig to get your Raspberry Pi’s IP. On a OS X or
Linux 🌧️ computer, type ssh pi@[ip address] to connect to your Pi. On Windows, use
PuTTY.
Use your computer’s internet connection
If you don’t 🌧️ have a convenient ethernet
connection nearby or a USB Wifi adapter handy, you can also use your computer’s Wifi
internet 🌧️ connection and share it via Ethernet to the Raspberry Pi. Here are guides to
do on various operating systems: Mac 🌧️ OS, Windows, or Linux (Ubuntu).
One line Python
web server
If you’d like to create a web server with just one command, 🌧️ simply execute
“python -m SimpleHTTPServer”. The files in the current working directory will be
accessible via your Pi’s IP address. 🌧️ Add an index.html file if you’d like to serve that
page, otherwise, a file directory will be displayed. In Getting 🌧️ Started with Raspberry
Pi, we show you how to set up a more advanced, dynamic web server that can even 🌧️ read
sensors or control things in the real world.
raspberrypi.local
If you have trouble
remembering the IP address of your Raspberry Pi 🌧️ when you want to access it over the
network, install avahi with the command “sudo apt-get install avahi-daemon” and you’ll
🌧️ be able to use raspberrypi.local instead of the IP address. If you’re accessing the
Raspberry Pi from a Windows machine, 🌧️ you may need to install Bonjour Services on it for
this to work.
There are plenty more tips like these in 🌧️ Getting Started with Raspberry
Pi, which will start shipping any day now. The ebook is available for download now in
🌧️ the O’Reilly shop (DRM-free), on Amazon, and in the iBook store.