Common Terminal commands in Raspberry Pi

You have a Raspberry Pi on hand, but not completely confident with Linux? Although the main desktop is easy to use, sometimes users need to rely on the command line entry in the terminal.

You have a Raspberry Pi on hand, but not completely confident with Linux? Although the main desktop is easy to use, sometimes users need to rely on the command line entry in the terminal. If you are new to the Raspbian and Linux operating systems, this is probably one of the issues.

If you are using a Raspberry Pi computer for some project (maybe a media center or home server), it is possible that these useful Raspberry Pi command line instructions will save you a lot of time.

Raspberry Pi and terminal commands need to know

  1. Raspberry Pi commands are the same as when using Linux
  2. 5 important Raspberry Pi update commands
  3. 5 basic concepts of command line in Raspberry Pi
  4. 10 commands to find Raspberry Pi hardware information
  5. 3 commands to check connected devices
  6. 3 commands to turn off and restart the Raspberry Pi

Raspberry Pi commands are the same as when using Linux

You copied the SD card, started the Raspberry Pi and ran the Raspbian operating system, updated and configured to optimize the Raspberry Pi. But you may not realize that even though the desktop is Windows-style, Raspbian is a Linux distribution. The operating systems available for Raspberry Pi most of them are Linux.

This does not make people use Linux sneakily! Users can install Linux on many devices. Rather, Raspberry Pi Foundation relies on Linux operating systems for the source and flexibility of open source. Although it is possible to use the Linux operating system without a command line, this is the real hidden source of power.

Want to have full control of Raspberry Pi running Raspbian OS? Start by launching the LX Terminal or launching the command line interface.

5 important Raspberry Pi update commands

To start using the command line you need to know how it works. Basically, this is the method that instructs the computer to perform tasks without a mouse.

Find the command prompt pi @ raspberrypi $ when you are in the terminal. You can enter the command whenever this prompt is displayed.

Perhaps the first thing to learn from the command line is the Raspberry Pi update. If using Raspbian, it is necessary to use 3 to 4 commands to update and upgrade Pi sources and operating systems:

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

To save time, combine them into a single command sequence:

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

5 basics of command line in Raspberry Pi

With the GUI controlled by mouse, you can easily switch folders and read their contents. However, some people may prefer the flexibility of commands.

  1. pwd displays the current directory (print the working directory).
  2. ls will list the contents of the directory.
  3. cd is used to change the directory. For example, cd edward passes the user to a subdirectory called 'Edward', while cd . returns to the parent directory.
  4. mkdir newdir will create a new directory, in which 'newdir' is the directory label. You can also create a new series of directories with mkdir -p / home / edward / newdir1 / newdir2 , where both newdir1 and newdir2 are created, but it will only work with the -p parameter .
  5. clear screen clear , useful when previous commands create too many things on the screen.

It's quite easy to grasp the basics of this command line, which is useful when navigating with the command line because some files and folders are hidden for the control file manager with the mouse.

10 commands to see Raspberry Pi hardware information

On Windows or Mac PCs, users can easily find hardware information by searching in System Information or About This Mac . To learn about Raspberry Pi hardware, enter the following information:

 cat /proc/cpuinfo 

Common Terminal commands in Raspberry Pi Picture 1Common Terminal commands in Raspberry Pi Picture 1

This command will export the device processor information. For example, if you see BCM2708, that means the chip is manufactured by Broadcom.

Run the following proc directory commands to discover other hardware information.

  1. cat / proc / meminfo shows details about Raspberry Pi memory.
  2. cat / proc / partitions shows the size and number of partitions on the SD card or hard drive.
  3. cat / proc / version indicates the Pi version is in use.

Common Terminal commands in Raspberry Pi Picture 2Common Terminal commands in Raspberry Pi Picture 2

Use these commands to evaluate Raspberry's capabilities. Not stopping there, users can find more information using the vcgencmd command string:

  1. vcgencmd measure_temp shows CPU temperature (very important if you are interested in airflow).
  2. vcgencmd get_mem arm && vcgencmd get_mem gpu indicates the memory division between CPU and GPU, can be adjusted in the configuration screen.
  3. free -o -h will display available system memory.
  4. top d1 checks the load on the CPU, showing details for all threads.
  5. df -h is a quick way to check the free disk space on Raspberry Pi.

Common Terminal commands in Raspberry Pi Picture 3Common Terminal commands in Raspberry Pi Picture 3

  1. uptime shows the average download of Raspberry Pi.

3 commands to check connected devices

Like when listing the contents of a directory with a single command, Linux allows users to list devices connected to the computer.

  1. ls / dev / sda * displays the list of partitions on the SD card. For Raspberry Pi with an attached HDD, replace sda * with hda *.
  2. lsusb displays all the attached USB devices. This is very important for connecting a hard drive or other USB hardware that requires configuration. If the device is listed here, users can set it up.

Common Terminal commands in Raspberry Pi Picture 4Common Terminal commands in Raspberry Pi Picture 4

  1. lsblk is another listed command that users can use. It displays information about all attached block devices (read and write storage in blocks).

3 commands to turn off and restart the Raspberry Pi

Perhaps the most important command line guide is sudo. Sudo instructs Linux-based systems that the following command will be executed with the 'super user' privilege . This is a high level of access like (but not exactly the same) admin on Windows computers.

Common Terminal commands in Raspberry Pi Picture 5Common Terminal commands in Raspberry Pi Picture 5

One of the most popular commands for Raspbian users is sudo raspi-config . It opens the configuration screen for the operating system (there is also a desktop version found via the main menu). The following three commands can be useful:

  1. startx will launch the Raspberry Pi GUI (graphical user environment) and bring you back to the default Raspbian desktop.
  2. sudo shutdown -h now will start the shutdown process immediately. Schedule a time-out shutdown with the format: sudo shutdown -h 21:55
  3. sudo reboot is to restart the Raspberry Pi from the command line.

For many people, command line access on any platform is scary. The useful commands listed here are intended to provide new users with Raspberry Pi a minimal platform to start with the terminal, a small stepping stone to success with any future Pi project.

Learning these commands can help users to use Linux more easily, since most of the commands above will work on any distribution! If you are new to using the Raspberry Pi, see what is the Raspberry Pi article and how is it used by TipsMake.com.

4 ★ | 1 Vote