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. 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
- Raspberry Pi commands are the same as when using Linux
- 5 important Raspberry Pi update commands
- 5 basic concepts of command line in Raspberry Pi
- 10 commands to find Raspberry Pi hardware information
- 3 commands to check connected devices
- 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.
- pwd displays the current directory (print the working directory).
- ls will list the contents of the directory.
- 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.
- 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 .
- 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
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.
- cat / proc / meminfo shows details about Raspberry Pi memory.
- cat / proc / partitions shows the size and number of partitions on the SD card or hard drive.
- cat / proc / version indicates the Pi version is in use.
Use these commands to evaluate Raspberry's capabilities. Not stopping there, users can find more information using the vcgencmd command string:
- vcgencmd measure_temp shows CPU temperature (very important if you are interested in airflow).
- vcgencmd get_mem arm && vcgencmd get_mem gpu indicates the memory division between CPU and GPU, can be adjusted in the configuration screen.
- free -o -h will display available system memory.
- top d1 checks the load on the CPU, showing details for all threads.
- df -h is a quick way to check the free disk space on Raspberry Pi.
- 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.
- ls / dev / sda * displays the list of partitions on the SD card. For Raspberry Pi with an attached HDD, replace sda * with hda *.
- 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.
- 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.
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:
- startx will launch the Raspberry Pi GUI (graphical user environment) and bring you back to the default Raspbian desktop.
- sudo shutdown -h now will start the shutdown process immediately. Schedule a time-out shutdown with the format: sudo shutdown -h 21:55
- 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.
You should read it
- How to use Terminal on a Mac
- 6 interesting terminal commands on Mac
- 18 terminal commands on Chromebook you should know
- How to add an ADC to Raspberry Pi: What you need to know
- Raspberry Pi Zero vs Model A and B, how are they different?
- How to run 2 or more Terminal commands at the same time on Linux
- What is the Raspberry Pi and how is the Raspberry Pi used?
- How to start Raspberry Pi 3 from USB
- Why should people try Raspberry Pi 4?
- Notable changes in Windows Terminal ver 0.11
- Learn Pi Imager, How to Use Raspberry Pi Imager
- How to set Windows Terminal to always open with Command Prompt on Windows 11
Maybe you are interested
How to use Raspberry Pi 400 as a laptop
Raspberry Pi Pico 2 W Launched: Wireless-Enabled Microcontroller Board for Just $7
How to build Android TV Box with Raspberry Pi 4
Raspberry Pi Touch Display Releases New Version After 9 Years
6 ideas to utilize old Raspberry Pi
Raspberry Pi AI Kit: Bring AI to Raspberry Pi