Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

coverMerry 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.

Matt Richardson

Matt Richardson

Matt Richardson is a Brooklyn-based creative technologist, Contributing Editor at MAKE, and Resident Research Fellow at New York University’s Interactive Telecommunications Program (ITP). He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.


Related

Comments

  1. TravisGood says:

    A nice “Good morning!” to new Pi owners on Christmas Day!

  2. Eric Chou says:

    Screen Multitask Remotely
    Somewhat related to number 4 & 7. When you are logged in remotely and want to multicast, you can always use screen (http://kb.iu.edu/data/acuy.html).
    1. Use ‘sudo apt-get install screen’ to get the program.
    2. Start the program with ‘screen’.
    3. Then use ‘Ctrl-a’ to enter the ‘command mode’ to enter screen-related commands.

    Example:

    1. Type ‘sudo apt-get install screen’ (I cant remember if the program was install by default or not)
    2. Type ‘screen’
    3. On current screen: (optional) Type ‘top’ to have something display on the screen.
    4. Create a new screen with: Ctrl-A, then type ‘C’
    5. Now you are on second screen. Type anything you want, such as ‘pwd, ‘ls’.
    6. To get back to the first screen: Ctrl-A, then type ’1′. You are now back at the output of ‘top’!
    7. Type ‘q’ to get out of the ‘top’ output. If you type exit at this point, you will terminate screen 1 and go to screen 2.

    Wow, a lot of words to illustrate something really simple. But once you use it once or twice, it will be second nature to you. Enjoy! :)

  3. john says:

    Sorry to sound critical.. but this has less to do with Raspberry Pi and more to do with Linux.

    As a linux non-noob but Raspi noob, I am quite disappointed in this guide, since there’s maybe one item that’s specific to the Raspi, and only barely.

    1. Matt Richardson says:

      I appreciate the feedback. I probably should have made the headline clearer. Another post is in order with more Raspberry Pi specific tips.

    2. I too arrived for an article that was hopefully pointing to some basic maker projects ; possibly accessing the GPIO or advice on the best power supplies or avoiding power drain on USB; something about how some SD Cards are a pain in the ass to get working with the PI and why sometimes it wont boot. Instead I found a simple bash shell scripting article; sure you can wrap it up and suggest that new raspberry pi owners might want to know about Linux but a headline to that effect would be good; meanwhile lets hear about power, sd cards, GPIO, Ethernet related projects, XMBC . stuff to started.

    3. Eric Chou says:

      Hi, I was in the same boat a few weeks back, receiving my RasPi for the first time and wonder about SOC, GPIO, Ethernet, etc. I find the book, Raspberry Pi User Guide (http://www.amazon.com/Raspberry-User-Guide-Gareth-Halfacree/dp/111846446X/ref=sr_1_1?s=books&ie=UTF8&qid=1356540810&sr=1-1&keywords=raspberry+pi) answered all of the questions for me. Written by the co-founder of Raspberry Pi Foundation, it does cover some Linux basics but also lots of hardware hacks. I solder for the first time and got the GPIO LED working in about 30 minutes after reading the chapter. :)

  4. [...] Ten Tips for New Raspberry Pi Owners [Make] [...]

  5. [...] even meaning to, I tripped over a useful blog post by Matt Richardson – 10 Tips for New Raspberry Pi Owners.  To enable local DNS-style naming of my RPi (raspberrypi.local), I needed to install the Avahi [...]

  6. [...] upcoming Getting Started with Raspberry Pi book (that we’ve been loving at Adafruit), from MAKE. (Read all ten tips [...]

  7. [...] o TightVNC - http://www.penguintutor.com/linux/tightvnc 10 dicas para usar o Raspberry Pi - http://blog.makezine.com/2012/12/25/ten-raspberry-pi-tips/ Raspbian “wheezy” - http://www.raspberrypi.org/downloads RASPBMC - http://www.raspbmc.com/ [...]

  8. [...] upcoming Getting Started with Raspberry Pi book (that we’ve been loving at Adafruit), from MAKE. (Read all ten tips [...]

  9. Steve says:

    My desktop connects wirelessly to my router. The RPi needs to live next to the desktop. The Wifi Dongle I use with the RPi gives a very poor connection so the “Use your computer’s internet connection” above seems ideal.

    I’ve shared the connection and plugged the RPi into the desktop via a network cable.

    Windows 7 recognises this as an active network describing it as “Unidentified network, Public network” . If I power the RPi down and up again the network from the active network list and reappears after it is identified. So something is working.

    But I’m a bit stuck as to what to do next to get an internet connection on the RPi. I’m guessing I need to open a connection to the RPi, but I don’t know what I’m doing. Any help would be greatly received.

    Steve

    1. Edwin says:

      Don’t use connection sharing, use Windows 7 feature Network Bridge:
      Open the Windows Network and Sharing Center (right-click network icon in taskbar). Click Change adapter settings (from sidebar menu). Hold CTRL to select your wireless adapter (connected to the router) and the ethernet adapter (connected to the Pi) then right-click either one and pick Bridge Connections from the context menu. Now the Pi will be assigned a DHCP address by the router and be able to access the internet. This also works when authorisation is required for the wireless network, as long as the desktop is authenticated. Note that you might have to sudo ifup eth0 on the Pi or reboot.
      Good luck and enjoy your Pi

      1. Anonymous Coward says:

        Or use Linux instead of Windows and properly enable packet routing to your pi – quagga is a rich routing package for Linux. AFter all, that’s what the pi is for: messing with things you don’t know about.

    2. What network adapter are you using? I recommend the Edimax 7811Un for the Raspberry Pi. Click on my name to have a look at my store.

  10. Martian says:

    I am somewhat disappointed – none of these is RPi tip, but just very basic bash/linux intro. Search linux, and you will find out much much more such tips.

    Also to switch to other virtual console when in graphics mode use Ctrl+Alt+F1 .. F9, switching back to graphics with Alt+F7 (On some distros it may be Alt+F1)

    1. Bruce says:

      Some of us are new to both Linux and Raspberry Pi so this does a lot for someone like me!

  11. Here’s a tip for all you new Raspberry Pi owners that want to monitor the status of your Raspberry Pi:
    Install Pimon (instructions at http://pimon.pedrocarrico.net/)
    Pimon is a simple server monitor designed for the Raspberry Pi, you can see it in action on my own Raspberry Pi at http://pec.no-ip.biz/

  12. [...] More from Christina Martin: craft / DIY garden animals fashion Sort Share blog.makezine.com       4 minutes [...]

  13. [...] MAKE | Ten Tips for New Raspberry Pi Owners [...]

  14. D Walton says:

    Nice article! If you create a new user on a Raspberry Pi running Ubuntu or Raspian, the default shell will not support things like command completion using the tab key. You can fix this by changing your shell:

    chsh -s /bin/bash

    You may want to copy things like .profile and .bashrc from the default user’s account.

    cp ~pi/.profile ~
    cp ~pi/.bashrc ~

    ~pi is the user named “pi’s” directory.
    ~ is your user directory

    I mention this because I spent a half hour wondering why command completion wasn’t working.

  15. [...] Ten Tips for New Raspberry Pi Owners (makezine.com) [...]

  16. Gus Smith says:

    Using terminal on OSX to ssh into raspi. What is the shortcut to terminate a running python programm (sudo python test.py) ? ctrl-c, ctrl-break, ctrl-z do not work on my computer?

  17. oscargoldman says:

    That Avahi part is flat-out wrong. You can’t just install avahi-daemon and then access your Pi over the network by name. You also have to set up a service description file under /etc/avahi/services. And even then I’ve yet to see it work.

    1. oscargoldman says:

      Turns out you also have to install Netatalk, THEN advertise its availability with Avahi.

  18. Good day! This is my first visit to your blog!
    We are a group of volunteers and starting a new initiative in a community
    in the same niche. Your blog provided us valuable information to work on.
    You have done a extraordinary job!

In the Maker Shed