Raspberry Pi

15 Most Useful Raspberry Pi Commands

The Raspberry Pi is a Linux-based operating system that operates mainly through the command-line terminal. If you are a beginner and have recently started working on the Raspberry Pi system, you should need help with the commands often used on the terminal. Since there are so many commands you can use on your Raspberry Pi system, in this article, we will show you the widely used ones that you should remember while using your Raspberry Pi system.

Most Useful Raspberry Pi Commands

As a Raspberry Pi user, you should know the most used commands on the Raspberry Pi system so that you can apply them whenever you work on the Raspberry Pi terminal. The most used commands on the Raspberry Pi system are as follows:

1: update and upgrade Commands

The update and upgrade commands on the Raspberry Pi system are crucial in updating your system packages. These two commands are widely used when installing a package on your Raspberry Pi system as they help to ensure the installation of the latest version of the packages on your system.

$ sudo apt update && sudo apt upgrade -y

In the above command, the first part checks for package update, while the second part begins updating the packages on your Raspberry Pi system. The “-y” flag allows the process to update the packages on your Raspberry Pi system.

2: apt install Command

This command is the most important one you can always use to install a package or application on your Raspberry Pi system. It installs the package directory from the main Raspberry Pi source list and if the repository of a specific application is included in the Raspberry Pi source list, it will be installed on your system. To use this command, you should follow the below-mentioned syntax:

$ sudo apt install <application_name>

3: clear Command

This one is another mostly used command on the Raspberry Pi system that clears all the previous information about the commands executed on your Raspberry Pi terminal. It works similarly to the one when you open the Raspberry Pi terminal, as instead of closing the Raspberry Pi terminal, you can use the following command to clear all the information.

$ clear

4: shutdown Command

Safely shutting down your Raspberry Pi terminal is crucial as this will increase the lifespan of your Raspberry Pi device. Instead of going with the unsafe option of shutting down the Raspberry Pi device from the main switch, you should use the following command to shut down your device safely.

$ sudo shutdown

When you apply the above command, it will schedule the shutdown and if you want to shut down immediately, you can add the “sudo shutdown now” command.

You can cancel the shutdown any time by applying the following command:

$ sudo shutdown -c

For detailed guidelines, you can visit here. You can also use “reboot” instead of shutting down your system as these two are one of the most used commands on the Raspberry Pi system.

5: cd Command

To visit a directory on your Raspberry Pi system from the terminal, this one is another widely used command that allows you to enter the directory and make changes accordingly. However, you must provide the directory location to enter the directory successfully.

$ cd <directory_path>

6: ls Command

The ls command is another widely used command on the Raspberry Pi terminal that allows users to view the directory’s contents on the terminal.

$ ls

For further details, you can follow the guideline provided here.

7: nano Command

Nano is a text editor which is by default installed on the Raspberry Pi system. The user can open or create a document on the Raspberry Pi terminal. You can create, edit, or open any file using the file location through the nano editor by following the below-mentioned syntax:

$ sudo nano <filename.txt>

You can make changes within the file and save it using CTRL+X keys.

8: raspi-config Command

The raspi-config is extremely useful that allows Raspberry Pi users to open the Raspberry Pi configuration on the terminal. In this way, the user can easily configure various settings right from their terminals.

$ sudo raspi-config

If you are new to the Raspberry Pi system, you can visit here to learn about Raspberry Pi configuration.

9: hostname Command

This is another useful command widely used by Raspberry Pi users to find out the system IP address.

$ hostname -I

You can also use this command to find the hostname of your Raspberry P by removing -I from the above command:

$ hostname

10: wget Command

This command is mostly used by Raspberry Pi users to download an application from the internet. The general syntax for using the command is as follows.

$ wget <link to download a file>

Although the above commands are useful for software-related tasks. However, on hardware related side, some commands are mostly used for finding the hardware-related information on Raspberry Pi, which are as follows:

11: df Command

The df command is used mostly on Raspberry Pi to check the storage information, as applying this command on your terminal outputs different partitions created on your Raspberry Pi system.

$ df

12: vcgencmd Command

The vcgencmd command is another widely used command that outputs the temperature of your Raspberry Pi device.

$ vcgencmd measure_temp

13: lscpu Command

The lscpu command is handy for finding the CPU-related information of your Raspberry Pi device and you can execute this command in the terminal to get the ouutput of various CPU related components.

$ lscpu

14: top Command

If you want to find the information about process running on your Raspberry Pi system, the top command will help you in that case as this command is widely adopted by Linux users.

$ top

15: lsblk Command

This lsblk command is another widely used command on Linux systems like Raspberry Pi that provide the list of disks created on your system with defined partition and size.

$ lsblk

Conclusion

Raspberry Pi is a Linux-based environment mostly handled through a command line terminal. There are so many commands you can execute on your Raspberry Pi terminal to perform a specific task, but here in this guideline, you will learn about some of them that are most used when performing a task, like installing a package, creating a web server and so on. You will also find a few commands that provide information related to your system’s hardware. You will need all these commands at almost every stage and you should remember these commands if you are new to the Raspberry Pi system.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.