30 Best Raspberry Pi Commands You Should Know

Rate this post

The Raspberry Pi provides a desktop GUI interface, but many prefer to use the command line for faster performance. If you are one of those people, you need to know some useful raspberry pie commands to make your life easier. This set of commands helps you manage your Raspberry Pi through the terminal. Also, learning these commands can be very helpful if you are setting up your Raspberry Pi without a monitor or Ethernet cable. So, without delay, check out the 30 best Raspberry Pi commands you should know in 2021.

Best Raspberry Pi Command (2021)

It contains both basic and advanced Raspberry Pi commands. Based on your level of expertise, check the list and make good use of these commands. Expand the table below to see the complete list of commands.

1. Update Raspberry OS

sudo apt-get update 
sudo apt-get upgrade

Best Raspberry Pi Command (2021)

If you are new to the Raspberry Pi, you need to know these two commands.They allow you to update the raspberry OS, both Desktop GUI and terminal-based interface, To the latest build.

Not only that, it also updates existing packages, dependencies, and repositories. Therefore, if you are setting up your Raspberry Pi for the first time, run these commands one at a time to run the latest version of the software.

2. Access the Raspberry Pi configuration

sudo raspi-config

sudo raspi-config

After the update command, this is the most convenient Raspberry Pi command. sudo raspi-config You can access all the key settings and settings of this single board computer. You can enable the GUI interface. Turn on the VNC server You can access the Raspberry Pi remotely, change the resolution, enable SSH, and more. If you want to handle system settings, run this command in your terminal to customize most of the settings to your liking.

3. Network configuration details


People use the Raspberry Pi primarily for network purposes, so they need to know all the details of their network configuration. Just enter the above command in the terminal Information about Ethernet and Wi-Fi details IP address, MAC address, etc.Let’s go ifconfig Is one of the best Raspberry Pi commands and you need to remember it to quickly find all your network information.

4. Open and edit the text file

sudo nano filename


sudo nano filepath

This may look like a basic Raspberry Pi command, but believe me. This is the most commonly used command when working with system files.Whenever you need to change the repository Add a new client to /etc/hosts, You can run this command to open the file in the Nano editor. Please note that Nano is a keyboard-based editor and you cannot use a mouse.

5. Restart your Raspberry Pi

sudo reboot

As the command indicates, you can restart your Raspberry Pi within seconds. When I run the command in the terminal, the Raspberry Pi shuts down automatically and turns on automatically.

6. Turn off the raspberry pie

shutdown -h now

Similarly, you can run the above command to turn off the Raspberry Pi.In fact, you can Schedule shutdown that too.Just replace now At a specific time such as 02:15, And the Raspberry Pi will shut down at 2:15 am. Remember that the Raspberry Pi follows a 24-hour clock.

7. Find the file

find / -name filename

I will say find One of the best commands on the Raspberry Pi.Can be done quickly Find files system-wide Indicates the location of the file. This way you can save a lot of time instead of manually searching for a specific file.

8. Run the script

chmod a+x filename.sh

You may want to download a script file (.sh) and run it on your Raspberry Pi, but you can only get the output “Access is denied” from the terminal.This is because the script properties Change to executable.. To do this, use the first command and it will be executable. Then run the second command and the script should work fine.

9. List files and directories


Best Raspberry Pi Command (2021)

ls Is a basic Raspberry Pi command, but it can be executed quickly View files and folders Under the current directory. As you progress, you’ll notice that you use this command quite often.

10. View background tasks



in my view, htop One of the best Raspberry Pi commands. It’s similar to Windows Task Manager, but with a terminal-based interface.You can see RAM usage, CPU usage, Number of tasks running in the background, uptime, etc. What I like about this command is that it can also display the CPU temperature, which is essential for managing RPi. Besides that, you can find the PID (process ID) and close the task with. kill Instructions.

11. Install the program

sudo apt-get install programname

Best raspberry pie command

If you want to install the app or utility on your Raspberry Pi, use the above command.Exchange programname With Program package name Press Enter. The app will be installed on your system immediately.

12. Scan the local network

sudo apt-get install nmap
nmap -sn

NS nmap Useful if you want to know the command IP addresses of all locally connected devices.. This command is especially useful if you have a Pi-hole set up on your Raspberry Pi. Therefore, if you want to scan your local network, nmap.. However, it is not pre-installed on the Raspberry OS and must be installed first (using the first command above).

13. Find the IP address of your Raspberry Pi

hostname -I

What you know is important IP address of Raspberry Pi It’s used almost everywhere, so it can be used with either VNC Connect or SSH. Therefore, just run the above command and you will get the IP address of your Raspberry Pi immediately.

14. Download the file

wget URL

Best raspberry pie command

wget It’s one of my favorite Raspberry Pi commands. A native downloader for Linux-based operating systems.Just type wget Add the URL to retrieve the file and press Enter. The file will be downloaded and saved in your current directory. How cool is it?

15. Check the Raspberry OS version

cat /proc/version

If you want to check the version of Raspberry OS you are running Linux information, Run the above command to get the information immediately. Helps to download packages and dependencies based on the current OS version.

16. Check the current directory


pwd A simple Raspberry Pi command to check the current directory. When working with many directories and subfolders, you may forget which directory the user is in. pwd Get the location of the current directory in the terminal.

17. Check the hardware information

cat /proc/meminfo
cat /proc/partitions

On the Raspberry Pi, you can check the hardware information using the above command.in the meantime lscpu You can find information about CPU cores. meminfo Provide you with memory information partitions Provides information about the size of the SD card.

18. Launch the GUI from the Raspberry Pi command line


If you are using the command line interface and want to go to the GUI desktop interface, you need to run. startx Terminal commands. Please note that the board must have the Raspberry Pi Desktop OS installed. If you have the Lite OS version installed, this command will not work.Let’s go startx One of the best Raspberry Pi commands for power users.

19. Create a directory

mkdir foldername

If you want to create a directory under the current folder, mkdir Enter the command and folder name together and it will be created immediately.Then you can use ls Check the above directory.

20. Delete a file or folder

rm foldername


rm filename

rm A Linux command that allows you to delete a file or folder directly from the terminal.Just type rm Along with the file or folder name.

21. Check the file by extension

cat *.txt

If you want to sort files based on file extension such as TXT, PDF, etc. cat Instructions. This command works like a Raspberry Pi charm.

22. Promoted permit

sudo su

If you see a “Permission denied” output on your Raspberry Pi, it means you don’t have permission to modify or access the file.In such cases, you can type sudo su Press Enter to enter the elevated permissions mode. Now you can run the command and no error will occur.

23. Change file ownership

sudo chown pi:root filename

Files are usually owned by root If you want to access them on your Raspberry Pi, you will get an error. In such cases, you need to change the ownership of the file as follows: pi.. If you want to work with system files and folders in the terminal, you need to use the above command.

24. Secure shell

ssh pi@[IP Address of Raspberry Pi]

If you want to access the Raspberry Pi terminal from another local device, you can use SSH commands from a command prompt, Powershell, Linux terminal, Mac terminal, and so on. Add the Raspberry Pi’s IP address to the above command and enter: yes When asked. Finally, enter your password. Usually it looks like this: raspberry..

25. Extract the file

unzip filename

NS unzip The utility is a very useful Raspberry Pi command.Just type in, regardless of file size unzip Extract the files in the current directory before the file name.

26. Extract the TAR file

tar -cvzf filename.tar.gz

The Raspberry OS also has a native feature to extract TAR files. If you enter the actual file name using the above command, it will be extracted on the fly.

27. Search the text in the file

grep keyword *.txt

NS grep Commands are a powerful utility that allows you to search for keywords in different file types. If you replace the keyword with the actual search string, all TXT files in that directory will be searched for that keyword. You can also replace TXT with PDF and other file formats.

28. Change your Raspberry Pi password


If you want to change the default password for the Raspberry Pi, type: passwd Press Enter. Now enter your current password and then your new password and you’re done.

29. Upgrade your Raspberry PiOS distribution

sudo apt-get dist-upgrade

If you have released a new update for your Raspberry Pi and want to move to the latest build, run the above command. This process will take some time, so please be patient.

30. Remove the package

sudo apt-get remove packagename

If you want to uninstall a program or package from your Raspberry Pi remove Command with package name. It will be deleted soon.

Find all the useful Raspberry Pi commands

So these are the best Raspberry Pi commands you can use to get things done with a tinkering board. I use most of them, and they are enough for my needs. The Raspberry Pi basically runs Linux internally, so you can find the best Linux commands from a carefully selected list. They also work with Raspberry Pi. Anyway, it’s all from us. If you want to set up a Raspberry Pi web server, go to the linked tutorial. Also, if you have any questions, please let us know in the comments section below.