15 Useful Commands Every Raspberry Pi User Should Know
Whatsapp Pinterest

If you’re using a Raspberry Pi computer for your weekend project 20 Awesome Uses for a Raspberry Pi 20 Awesome Uses for a Raspberry Pi With so many cool projects for the Raspberry Pi, it can be hard to decide what to make. In this mega guide, we round up 20 of the very best projects around! Read More (perhaps a media centre or a home server) then there is a good chance these useful command line instructions will save you some time.

The Raspberry Pi: Yes, It’s Linux

You’ve imaged your SD card and booted your Raspberry Pi. You’re probably using the Raspbian operating system and updated and configured it so that it meets your requirements. What you may not have realised is that despite the Windows-style icon-driven desktop, Raspbian is a Linux distribution How to Update Your Raspberry Pi to the Latest Raspbian OS How to Update Your Raspberry Pi to the Latest Raspbian OS Here's why Raspbian Stretch is the best Raspberry Pi update in a while, and how to update your own Raspberry Pi to it. Read More . Several operating systems are available for Raspberry Pi 11 Operating Systems You Can Run on Raspberry Pi 11 Operating Systems You Can Run on Raspberry Pi The Raspberry Pi's hardware is only one side of the coin. Here are some different Raspberry Pi operating systems you can install. Read More , the vast majority of which are Linux.

Rather than an attempt to get people using Linux by stealth, the Raspberry Pi relies on these operating systems because of their open source origins and versatility.

(And because it’s rather good.)

Now, you can probably use a Linux operating system with a graphical user interface without using the command line, but this is where most of the real power lies.


Want power over your Raspbian-powered Raspberry Pi? Begin by launching LX Terminal.

Raspberry Pi Command Line Basics

We wouldn’t expect you to start using the command line without knowing how it works. Essentially, it is a method for instructing the computer to perform tasks. It’s really not all that different from pointing and clicking, only you’re expected to use text.


When you first access the command line, you’ll see the pi@raspberrypi $ prompt – whenever this is displayed you’ll be able to enter commands.

With a mouse-driven GUI, you can easily switch directories and read their contents. In the command line, you can check which directory you’re viewing by entering pwd (print working directory). Use ls to list the contents of the directory, and change directory by entering cd. For instance, cd edward will switch to a directory called “edward”, while cd.. will always return focus to the parent directory. New directories are possible with mkdir newdir, where “newdir” is the directory label. You can also create a succession of new directories with mkdir –p /home/edward/newdir1/newdir2, where both newdir1 and newdir2 are created, but this will only work with the –p switch.

These are basics of all command line interfaces, and can be easily picked up. What you really need are useful commands.

Display Hardware Information


On a Windows PC or Mac you can easily find hardware information by looking in System or About This Mac. To find out about your Raspberry Pi’s hardware, enter the following:

cat /proc/cpuinfo

This will output information about the device’s processor. For instance, where you see BCM2708, this indicates that the chip was manufactured by Broadcom.

Various other hardware information can be found by running commands under the proc directory.

  • cat /proc/meminfo displays details about the Raspberry Pi’s memory
  • cat /proc/partitions reveals the size and number of partitions on your SD card or HDD
  • cat /proc/version shows you which version of the Pi you are using.

All of these details can be used to assess what your Raspberry Pi might be capable of. Further information can be acquired using the vcgencmd series of commands, which can reveal things like CPU temperature (vcgencmd measure_temp). This can prove vital if you’re concerned about airflow.


Other technical commands include free -o -h to see how much free system memory is available, while vcgencmd get_mem arm && vcgencmd get_mem gpu will reveal the memory split between the CPU and GPU, something that can be adjusted in the Raspbian config screen (see below).

As with the file structure, the ls command can be used to list items attached to your Raspberry Pi, specifically USB hardware. Use lsusb to display a list of attached devices – you’ll find this crucial for setting up a wireless network, mounting a hard disk drive or attaching any other USB hardware that requires some configuration.


As long as the item is listed here, you should be able to set it up.

Three Important Terminal Commands

Perhaps the most important command line instruction is sudo. This single word instructs Linux-based systems such as Raspbian that the following command is to be carried out with “super user” privileges, an advanced level of access similar to (but not the same as) administrator on Windows computers.

For example, sudo apt-get install synaptic will download and install the synaptic package manager (one of several methods of installing software on the Raspberry Pi 5 Ways To Install Software On Raspberry Pi 5 Ways To Install Software On Raspberry Pi To do anything with a Raspberry Pi, you'll need to know how to install an operating system, and software to run on it. If you're new to Linux, this can be daunting. Read More ).


One of the most common commands for Raspbian users is sudo raspi-config. This opens the configuration screen for the operating system, which has been updated considerably since it was first released.

When you’re done in the Raspberry Pi command line, and you’re using the Raspbian (distro), enter startx to return to the graphical, mouse-driven interface. If, on the other hand, you wish to shutdown, use sudo shutdown –h now to immediately begin the system halt and shutdown process.


You can restart with sudo shutdown –r now. A timed shutdown can be set by including a value, such as 5 minutes, or a time, such as 21:55:

sudo shutdown –h 21:55

Command Line Information Is Power

For many people, command line access on any platform is intimidating.

The useful commands listed here are an attempt to give the Raspberry Pi newcomer the bare minimum to get started with the terminal, a small stepping stone to success with whichever Pi project they decide to start.

If you’re new to the Raspberry Pi, don’t forget to check out our unofficial Raspberry Pi guide Raspberry Pi: The Unofficial Tutorial Raspberry Pi: The Unofficial Tutorial Whether you're a current Pi owner who wants to learn more or a potential owner of this credit-card size device, this isn't a guide you want to miss. Read More .

Meanwhile, if you have any commands that you regularly input into your Raspberry Pi terminal, don’t forget to share them in the comments below.

SmartiPi Touch case for The Official Raspberry Pi 7" Touchscreen Display - Adjustable Angle SmartiPi Touch case for The Official Raspberry Pi 7" Touchscreen Display - Adjustable Angle Buy Now At Amazon $27.99

Featured Image Credit: Osde-Info

Explore more about: Raspberry Pi, Terminal.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Siddhi
    January 19, 2018 at 6:20 pm

    try: ls -a in /Home, open the bash file with 'nano .bashrc' you can then speed up file navigation etc by entering an alias such as "alias multiT='clear; whomami; ls -al'" etc

  2. sir isley reale
    October 6, 2017 at 5:55 pm

    I am on a pi :p

  3. Farjad
    July 13, 2017 at 7:35 am

    Thanks, I recently bought a RPi3, this article proved to be helpful.

  4. Paul
    March 3, 2017 at 12:41 am

    Great article, I've been using bash not just on the Pi, but other architecture as well for a couple of years.

    I always used shutdown to halt or restart from terminal, however I have recently just used poweroff or reboot.

    • Christian Cawley
      March 31, 2017 at 7:38 pm

      Thanks, Paul, nice to hear. Which command do you prefer for shutting down?

  5. mars
    September 2, 2016 at 10:34 pm

    Any command to shutdown and restart in 5 minutes?

    • I eat Pi for tea
      September 21, 2016 at 7:34 am

      shutdown -r 5

  6. Camille
    May 13, 2016 at 11:08 pm

    top d 1 for checking cpu usage for instance
    df -h for disk space
    uptime for load average for instance

  7. Christopher
    May 11, 2016 at 2:27 am

    cat /proc/version does not really give you useful information, unless you are a supergeek hacker. It doesn't really tell you the version of Raspberry Pi you have. Rather it tells you what version of Linux kernel you are running, plus a few other geekish things.

    The following command will update your Raspberry Pi thoroughly!
    Type it in once (or copy and paste it). Once it is in the command history, it is super easy to use. All you have to do is use the up arrow key to find it, hit Enter, and off you go again.
    I use this command almost every day.

    sudo apt-get update -y && sudo apt-get update -y && sudo apt-get autoremove -y && sudo apt-get dist-upgrade -y && sudo rpi-update

  8. Giovanni
    April 14, 2014 at 8:05 am

    Nice article, and you're right. Mastering the command line opens up all sorts of options.

    There's one typo : "For instance, cd edward will switch to a directory called “Edward”
    They both should be edward (or Edward) . Unlike Windows where they're treated identically, in Linux, the filenames are case-sensitive.

    Once you've mastered these commands, check out ssh. It allows you to connect and give commands from any PC by giving you a terminal window that connects over the network, so you don't need a display or keyboard plugged into the Pi. Tis very handy.

    • Christian Cawley
      May 14, 2016 at 8:00 pm

      Unfortunate oversight, thanks for pointing it out!

  9. andycrofts
    April 5, 2014 at 3:51 pm

    @tom g:
    Just get one! Cheap as chips, and EXTREMELY addictive.
    Check mine out.
    and have a look at the PILAB tab, and the drivel I've documented.
    Yeps, the webserver's running on a Pi.
    Cheers, and have shedloads of fun!
    Andy, Oulu, Finland

  10. Jim K
    April 5, 2014 at 6:41 am

    Be careful with Linux based Operating systems cd edward will never change your directory to one called Edward. Linux is case sensitive, cd edward will only switch you to a directory called edward all lower case.

  11. DrToxic
    April 2, 2014 at 10:01 am

    I still don't run the Debian Image on my Pi.
    Risc OS is much faster and easier to code for

    • Christian Cawley
      August 5, 2016 at 8:37 am

      It's a fair point, and there's something poetic about using a Cambridge developed OS with a Cambridge developed device and processor.

      • Eddie
        November 1, 2016 at 4:03 pm

        Used RISC on older large telephone systems in the past (iSDX) !

        Thanks for the information regarding the CLI via SSH

  12. tom g
    April 1, 2014 at 8:56 am

    I so want to get one of these!

  13. Jurmy C
    March 31, 2014 at 6:36 pm

    Useful, thank you.