30 Best Raspberry Pi Commands You Should Know
While Raspberry Pi offers a desktop GUI interface, many prefer using the command-line for faster performance. If you’re one of those people, you must know some useful Raspberry Pi commands to make your life easier. This set of commands will help you manage the Raspberry Pi through the Terminal. Also, if you aresetting up Raspberry Pi without a monitor or Ethernet cable, learning these commands will help you a lot. So without any delay, let’s check out the 30 best Raspberry Pi commands you should know in 2021.
Best Raspberry Pi Commands
Here, we have included both basic and advanced commands for Raspberry Pi. Based on your expertise level, go through the list and put these commands to good use. Just expand the table below and check out the complete list of commands.
1. Update Raspberry OS
If you are new to Raspberry Pi, you must know these two commands. They allow you to update the Raspberry OS, both thedesktop GUI and Terminal-based interface, to the latest build.
Not just that, it also updates existing packages, dependencies, and repositories. So if you haveset up a Raspberry Pi for the first time, make sure to run these commands one by one to run the latest version of the software.
2. Access Raspberry Pi Configuration
After the update commands, this is the most useful Raspberry Pi command.sudo raspi-configlets you access all the key settings and preferences of thissingle board computer. You can enable the GUI interface,turn on the VNC servertoremotely access Raspberry Pi, change the resolution, enable SSH, and lots more. I would say, if you want to deal with system settings, run this command in the Terminal and customize most of the preferences to your liking.
3. Network Configuration Details
Since people use Raspberry Pi for mostly networking things, you must know all the network configuration details. Simply type the above command in the Terminal to findinformation about the Ethernet, Wi-Fi detailssuch as IP address, MAC address, and more. I thinkifconfigis one of the best Raspberry Pi commands, and you should remember it to find all the network information quickly.
4. Open and Edit a Text File
or
This may seem like a basic Raspberry Pi command, but believe me, this is the command you will be using the most while dealing with system files. Whenever you have to modify the repository oradd a new client to/etc/hosts, you can execute this command to open the file with Nano editor. Keep in mind that Nano is a keyboard-based editor, and you can’t use your mouse.
5. Restart Your Raspberry Pi
As the command suggests, it lets you restart your Raspberry Pi within seconds. Run the command in the Terminal, and your Raspberry Pi will automatically shut down and turn on itself.
6. Power Off Raspberry Pi
Similarly, you can run the above command to turn off your Raspberry Pi. In fact, you canschedule the shutdowntoo. Just replacenowwith a specific time such as02:15, and the Raspberry Pi will shut down at 2:15 am. Just remember, Raspberry Pi follows the 24-hour clock.
7. Find a File
I would sayfindis one of the best commands for Raspberry Pi. It lets you quicklylook for a file within the whole systemand shows where the file is located. This way, you can save a lot of time instead of hunting down a specific file manually.
8. Run a Script
Sometimes you download a script file (.sh) and want to run it on your Raspberry Pi, but all you get from the Terminal is the “Permission denied” output. That’s because the script’s property has not beenchanged to executable. To do that, use the first command, and it will become executable. Next, run the second command, and the script should work without any issues.
9. List Files and Directories
lsis a basic Raspberry Pi command, but it allows you to quicklyview files and foldersunder the current directory. As you move along, you will find yourself using this command pretty often.
10. View Background Tasks
In my view,htopis one of the best Raspberry Pi commands. It is similar to the Task Manager on Windows but in a Terminal-based interface. You can view theRAM usage, CPU usage, how many tasks are running in the background, uptime duration, and a lot more. What I love about this command is that it also lets me view the CPU temperature, which is essential for managing RPi. Other than that, you can find the PID (Process ID) and close the task with thekillcommand.
11. Install a Program
If you want to install an app or utility on your Raspberry Pi, use the above command. Replaceprogramnamewith thepackage name of the programand hit enter. The app will be installed on the system right away.
12. Scan the Local Network
Thenmapcommand will come in handy if you want to find out theIP addresses of all the locally connected devices. This command is especially helpful if you haveset up Pi-hole on your Raspberry Pi. So if you want to scan the local network, usenmap. That said, you will first need to install it (using the first command listed above) as it does not come preinstalled with Raspberry OS.
13. Find the IP Address of Raspberry Pi
It’s important that you know theIP address of your Raspberry Pias it is used almost everywhere, be it for VNC Connect or SSH. So just run the above command, and you will get Raspberry Pi’s IP address instantly.
14. Download a File
wgetis one of my favorite Raspberry Pi commands. It’s a native downloader forLinux-based operating systems. Just typewgetand add the URL from where you want to fetch the files and hit enter. The file will be downloaded and saved in the current directory. How cool is that, right?
15. Check Raspberry OS Version
If you want to check which version of Raspberry OS you are running, along with theLinux information, execute the above command to get the information right away. It will help you download packages and dependencies based on your current OS version.
16. Check Current Directory
pwdis a simple Raspberry Pi command to check your current directory. Sometimes, while working through many directories and subfolders, users forget which directory they are in. So typepwdin the Terminal to get the current directory location.
17. Check Hardware Information
On Raspberry Pi, you can check out hardware information with the above commands. Whilelscpulets you find information about CPU cores,meminfooffers you memory information andpartitionsgives information about SD card size.
18. Start GUI from Command Line on Raspberry Pi
If you are on a command-line interface and want to move to the GUI desktop interface, you need to execute thestartxcommand in the Terminal. Do keep in mind, you must have Raspberry Pi Desktop OS installed on your board. If you have installed the Lite OS version, this command will not work. I thinkstartxis among the best Raspberry Pi commands for power users.
19. Create Directory
If you want to create a directory under the current folder, use themkdircommand along with a folder name, and it will be created instantly. You can then uselsto check the said directory.
20. Delete Files or Folder
or
rmis again a Linux command that lets you delete a file or folder right from the Terminal. Just enterrmalong with the file or folder name.
21. Check Files by Extension
If you want to sort files based on the file extension like TXT, PDF, etc., you can use thecatcommand. This command works like a charm on Raspberry Pi.
22. Elevated Permission
On Raspberry Pi, if you get the “Permission denied” output, it means you don’t have the privilege to modify or access that file. In such cases, you can typesudo suand hit enter to get into the elevated permission mode. Now, you can execute the command and won’t face any errors.
23. Change File Ownership
Generally, files are owned byrooton Raspberry Pi, and if you want to access them, you will face an error. In such cases, you need to change the ownership of the file topi. It requires you to use the above command as you’re dealing with system files and folders in the Terminal.
24. Secure Shell
If you want to access Raspberry Pi’s terminal from any other local device, you can use the SSH command from Command Prompt, Powershell, Linux Terminal, Mac Terminal, etc. Just add the IP address of your Raspberry Pi in the command above and typeyeswhen asked. Finally, enter the password, which usually israspberry.
25. Extract Files
Theunziputility is such a useful Raspberry Pi command. No matter the file size, just enterunzipbefore the filename to extract the files in the current directory.
26. Extract TAR Files
Raspberry OS has native ability to extract TAR files as well. Use the command above and enter the actual filename, and it will extracted then and there.
27. Search for Text Within Files
Thegrepcommand is a powerful utility that allows you to search for keywords inside different file types. Replace the keyword with your actual search string, and it will look for that keyword in all TXT files in that directory. You can also replace TXT with PDF and other file formats.
28. Change Password of Raspberry Pi
If you want to change the default password of Raspberry Pi, just enterpasswdand hit enter. Now, enter the current password and then enter the new password, and you are done.
29. Upgrade Raspberry Pi OS Distribution
If a new update to Raspberry Pi has been released and you want to move to the latest build then run the above command. This process will take time so keep patience.
30. Remove a Package
If you want to uninstall a program or a package from Raspberry Pi, execute theremovecommand along with the package name. It will be removed immediately.
Find All the Useful Raspberry Pi Commands
So these are the best Raspberry Pi commands you can use to get things done on your tinker board. I use most of them, and they do suffice my needs. Since Raspberry Pi is essentially running Linux under the hood, you can find thebest Linux commandsfrom our curated list. They will work on Raspberry Pi too. Anyway, that is all from us. In case you want toset up a Raspberry Pi web server, head over to our linked tutorial. And if you have any questions, let us know in the comment section below.
Arjun Sha
Passionate about Windows, ChromeOS, Android, security and privacy issues. Have a penchant to solve everyday computing problems.
Add new comment
Name
Email ID
Δ
01
02
03
04
05