Do you have a Raspberry Pi but not quite sure about Linux? While the main desktop is easy enough to use, sometimes you need to rely on command line input in the terminal. But if you’re new to the Raspbian operating system and Linux, this is easier said than done.

Unlock «Cheat Sheet on Basic Linux Commands» now!

This will subscribe you to our newsletter

Enter your email address
Read our privacy policy

If you’re using a Raspberry Pi computer for a weekend project (perhaps a media center or home server), then there’s a good chance these helpful Raspberry Pi command line instructions will save you some time.

Raspberry Pi Commands: You’re Using Linux

You’ve created an image of your SD card and booted up your Raspberry Pi, and have been working with the Raspbian operating system updated and tuned to optimize your Raspberry Pi.

You may not have realized that despite having a Windows-style desktop, Raspbian is a Linux distribution. There are several operating systems available for Raspberry Pi operating systems, which the vast majority of which are Linux.

This is not an attempt to get people to use Linux behind the scenes! You can install Linux on a huge variety of devices. Rather, the Raspberry Pi Foundation relies on Linux operating systems for their open source and versatility. While you can use the Linux operating system without the command line, that’s where the real power lies.

Want full control of your Raspberry Pi on Raspbian? Start with launch terminal LX or download from the command line.

5 Important Raspberry Pi Update Commands

We don’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, but without a mouse.

Looking for an invitation pi@raspberrypi$ upon entering the terminal. You can enter commands whenever it is displayed.

Probably the first thing you should learn to do from the command line is update your Raspberry Pi. If you’re using Raspbian, this is a case of using three or four commands to update and update the Pi’s sources and operating system:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get dist-upgrade
  • sudo rpi-update

To save time, combine them into one chained command:

  • sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo rpi-update

5 Raspberry Pi Command Line Basics

With a mouse-driven GUI, you can easily switch directories and read their contents. However, you may prefer the flexibility of text commands.

  • pwd shows the current directory (print working directory).
  • ls will list the contents of the directory.
  • CD used to change directory. For example, cd edward with switches you to a child directory named «Edward» and cd .. returns focus to the parent directory.
  • mkdir newdir will create a new directory, where «newdir» is the label of the directory. You can also create a sequence of new directories with mkdir -p /home/edward/newdir1/newdir2 where both newdir1 and newdir2 are created, but this will only work with -p
  • clear presents a clean new screen, useful if your previous commands are cluttering things up.

You will easily understand these command line basics. It’s useful to be able to navigate the command line, as some files and folders are invisible to the mouse-driven file manager.

10 Commands for Raspberry Pi Hardware Information

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

  • cat /proc/cpuinfo

Discover information about the Raspberry Pi processor

This will display information about the device’s processor. For example, when you see «BCM2708» it indicates that Broadcom made the chip.

Run these proc directory commands to reveal other hardware information.

  • cat /proc/meminfo displays Raspberry Pi memory details.
  • cat /proc/partitions shows the size and number of partitions on your SD card or hard drive.
  • cat /proc/version shows what version of Pi you are using.

Check Current Linux Versions

Use these commands to see what your Raspberry Pi is capable of. It doesn’t end there. Find more information using a series of commands vcgencmd :

  • vcgencmd measure_temp shows CPU temperature (vital if you’re worried about airflow).
  • vcgencmd get_mem arm && vcgencmd get_mem gpu will show the memory sharing between CPU and GPU, which can be configured on the configuration screen.
  • free-o-h will display the available system memory.
  • top d1 checks your CPU load by displaying details for all cores.
  • df-h is a great way to quickly check free disk space on your Raspberry Pi.

How much free space does your Raspberry Pi's SD card have?

  • uptime is a simple command that displays the load average of the Raspberry Pi.

3 commands to check connected devices

Just as you can list the contents of a directory with a single command, Linux allows you to list the devices connected to your computer.

  • ls /dev/sda * displays a list of partitions on the SD card. For a Raspberry Pi with a hard drive attached, replace sda ​​* with hda *.
  • lsusb displays all connected USB devices. This is very important for connecting a hard drive or other USB equipment that needs to be configured.

Use lsusb to find out about USB devices connected to Raspberry Pi

If an element is listed here, you will be able to customize it.

  • lsblk is another list command you can use. Displays information about all connected block devices (storage that reads and writes in blocks).

3 Commands to Shutdown and Restart Raspberry Pi

Perhaps the most important command line instruction is − sudo . This one word instructs Linux-based systems that the following command should be run with «superuser» privilege. This is an advanced level of access, like (but not like) administrator on Windows computers.

Raspberry Pi configuration tool

One of the most common commands for users Raspbian- this is sudo raspi-config . This opens the configuration screen for the operating system (there is also a desktop version found via the main menu). The following three commands may be helpful:

Raspberry Pi Power Terminal Commands

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

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

There’s an added bonus: learning these commands can lead you to switch to Linux, as most will work with any distribution! If you’re new to the Raspberry Pi, check out our Raspberry Pi Basics article everyone should know.

And for a cool project, check out how to turn your Raspberry Pi into a secure travel router turn your Raspberry Pi into a secure router

Похожие записи