Introduction
For Beginners If you’re just getting started with your Raspberry Pi, you might be wondering what all the terminal commands are about. Here’s a beginner’s guide to some of the most common commands.
you have a Raspberry Pi, you can use it to control various devices or perform various tasks. In order to do so, you will need to know some basic commands. This guide will teach you some of the most basic Raspberry Pi commands.
Raspberry Pi is a credit card-sized computer that can be used for various purposes. It is a versatile device that can be used for both home and industrial applications. Raspberry Pi has many capabilities and can be used as a regular computer for browsing the Internet, playing media, and even gaming. It can also be used for more advanced applications such as monitoring environmental data or controlling robots. the Raspberry Pi can do it all. What is Raspberry Pi? A Basic Overview & Introduction
This reader overviews some of the most commonly used Raspberry Pi commands for beginners. These commands can be used to perform various tasks on the device, including opening and closing programs, viewing files, and changing settings. With a little practice, anyone can become proficient in using these commands to get the most out of their Raspberry Pi
Enhancing Your Command-Line Talent
For those who are new to Raspberry Pi and Linux. This first post will cover the main pages and keyboard shortcuts. In the following post, I will Raspberry Pi commands and their functions.
Keyboard Shortcuts
Keyboard shortcuts are everywhere in Linux. Below are a few I discover especially useful:
- Ctrl-A goes to the beginning of the line.
- Ctrl-E goes to the end of the line.
- Ctrl-r reverse search your history for a command.
- cd move to your home directory.
- cd – go to the last directory (especially useful when jumping back and forth between a pair of directories.
- Ctrl-l clears the screen (the same as clear).
- sudo !! run the last command with sudo.
- Tab auto-complete command, file and folder names
- Up arrow previous command (walk back through the command history).
- Down arrow walk forward via the command history.
Best Raspberry Pi Commands
Here, we have had both basic and advanced commands for Raspberry Pi. Based on your expertise rank, go via the list and put these commands to the right use.
A Quick Reference Guide In this guide, we’ll show you a quick reference of useful Raspberry Pi commands. The Raspberry Pi is a great little device with a wide range of uses. From a basic computer to a gaming console, the Raspberry Pi can do it all. And with the right commands, you can get the most out of your Raspberry Pi.
Looking at the terminal we observe the following information that we explain below:
1 |
pi@raspberrypi: ~ $ cd /home/pi |
- pi: indicates the user connected to the terminal
- @: means “in”
- raspberry pi: indicates the name of the machine to which we are connected
- ~: indicates the path in which we are, in this case, the default home path
- $: indicator to start typing new orders or commands
As an example, we could say that we are connected to the raspberry pi device with the raushan user, who is inside the /Zeba/www folder and is executing the command to list all the files showing all their properties:
1 |
raushan@raspberrypi: /Zeba/www $ ls -la |
Basic Raspberry Pi Commands
1. Raspberry Pi Configuration Command
1 |
pi@raspberrypi: ~ sudo raspi-config |
2. Update Raspberry Pi Command
1 2 3 |
pi@raspberrypi: ~ sudo apt-get update pi@raspberrypi: ~ sudo apt-get upgrade pi@raspberrypi: ~ sudo apt-get full-upgrade |
3. Command used to install and update packages
1 |
pi@raspberrypi: ~ apt-get |
4. List Files and Directories
1 |
pi@raspberrypi: ~ ls |
5. Show files in sub-directories as well
1 |
pi@raspberrypi: ~ ls -R |
6. Show hidden files as well
1 |
pi@raspberrypi: ~ ls -a |
7. Show files and directories with detailed information like permissions, size etc.
1 |
pi@raspberrypi: ~ ls -al |
8. Navigate to the HOME directory
1 |
pi@raspberrypi: ~ cd or cd ~ |
9. Move one level up
1 |
pi@raspberrypi: ~ cd .. |
10. Move to the root directory
1 |
pi@raspberrypi: ~ cd / |
11. Creates a new file
1 |
pi@raspberrypi: ~ cat > filename |
1 |
pi@raspberrypi: ~ cat filename |
1 |
pi@raspberrypi: ~ rmdir |
Raspberry Pi File Permission commands
- To show file type and access permission
1 |
pi@raspberrypi: ~ ls -l |
2. Read the permission
1 |
pi@raspberrypi: ~r |
3. write permission
1 |
pi@raspberrypi: ~ w |
1 |
pi@raspberrypi: ~ x |
5. No permission
1 |
pi@raspberrypi: ~ -= |
Raspberry Pi Networking command
- Network Configuration Details
1 |
pi@raspberrypi: ~ $ ifconfig |
2. Login into a remote Pi machine using SSH
1 |
SSH username@ip-address or hostname |
3. Show files in the current directory of a remote computer
1 |
pi@raspberrypi: ~ dir |
1 |
pi@raspberrypi: ~ cd "dirname" |
1 |
pi@raspberrypi: ~ put file |
6. Download ‘file’ from the remote to the local computer
1 |
pi@raspberrypi: ~ get file |
7. Logout
1 |
pi@raspberrypi: ~ quit |
Raspberry Pi Process command
- Change the Password of the Raspberry Pi
1 |
pi@raspberrypi: ~ $ passwd |
2. Upgrade Raspberry Pi OS Distribution
1 |
pi@raspberrypi: ~ $ sudo apt-get dist-upgrade |
3. Remove a Package
1 |
pi@raspberrypi: ~ $ sudo apt-get remove packagename |
4. Now Shutdown the machine
1 |
pi@raspberrypi: ~ $ shutdown -h now |
5. Schedule a machine shutdown
1 |
pi@raspberrypi: ~ $ shutdown -h 10:30 & |
6. Cancel a scheduled shutdown
1 |
pi@raspberrypi: ~ $ shutdown -c |
7. Restart Your Raspberry Pi
1 |
pi@raspberrypi: ~ $ sudo reboot |
8. Reboot the machine
1 |
pi@raspberrypi: ~ $ shutdown -r now |
9. Log out user
1 |
pi@raspberrypi: ~ $ logout |
10. Close the terminal
1 |
pi@raspberrypi: ~ $ exit |
11. Details on all Active Processes
1 |
pi@raspberrypi: ~ top |
12. To send a process to the background
1 |
pi@raspberrypi: ~ bg |
13. To run a stopped process in the foreground
1 |
pi@raspberrypi: ~ fg |
14. Give the status of processes running for a user
1 |
pi@raspberrypi: ~ ps |
15. Shows free RAM on your system.
1 |
pi@raspberrypi: ~ $ free |
16. Show free hard disk space on your system
1 |
pi@raspberrypi: ~ $ df |
17. Kills a process
1 |
pi@raspberrypi: ~ $ kill PID |
Raspberry Pi System information commands
- Displays The Cpu Temperature
1 |
pi@raspberrypi: ~ $ vcgencmd measure_temp |
2. Details on all Active Processes
1 |
pi@raspberrypi: ~ $ top |
3. Shows The Architecture Of The Machine Command
1 |
pi@raspberrypi: ~ $ arch |
4. Shows The Name Of The Operating System Command
1 |
pi@raspberrypi: ~ $ uname |
5. Show Active Processes
1 |
pi@raspberrypi: ~ $ sudo top |
6. View Connected USB Devices
1 |
pi@raspberrypi: ~ $ lusb |
7. Shows The History Of Entered Commands
1 |
pi@raspberrypi: ~ $ <span class="hljs-built_in">history</span> |
8. Displays The System Date
1 |
pi@raspberrypi: ~ $ date |
9. Shows Current Directory
1 |
pi@raspberrypi: ~ $ <span class="hljs-built_in">pwd</span> |
10. Open the File and Edit a Text File
1 |
pi@raspberrypi: ~ $ sudo nano filename |
or
1 |
pi@raspberrypi: ~ $ sudo nano filepath |
11. Find a File
1 |
pi@raspberrypi: ~ $ find / -name filename |
12. Run a Script
1 2 |
chmod a+x filename.sh pi@raspberrypi: ~ $ ./filename.sh |
13. View Background Tasks
1 |
pi@raspberrypi: ~ $ htop |
14. Install a Program
1 |
pi@raspberrypi: ~ $ sudo apt-get install programname |
15. Find the IP Address of the Raspberry Pi
1 |
pi@raspberrypi: ~ $ hostname -I |
16. Download a File
1 |
pi@raspberrypi: ~ $ wget http://www.website.com/example.txt |
17. Check the Raspberry OS Version
1 |
pi@raspberrypi: ~ $ cat /proc/version |
18. Check Hardware Information
1 2 3 |
lscpu pi@raspberrypi: ~ $ cat /proc/meminfo pi@raspberrypi: ~ $ cat /proc/partitions |
19. Create a Directory
1 |
pi@raspberrypi: ~ $ mkdir foldername |
20. Delete Files or Folder
1 |
pi@raspberrypi: ~ $ rm foldername |
21. Extract Files
1 |
pi@raspberrypi: ~ unzip filename |
22. Extract TAR Files
1 |
pi@raspberrypi: ~ $ tar -cvzf filename.tar.gz |
23. Access the directory that follows
1 |
pi@raspberrypi: ~ $ cd /home/pi |
24. Opens the GUI (Graphical User Interface).
1 |
pi@raspberrypi: ~ $ startx |
25. Show the contents of the file example.txt
1 |
pi@raspberrypi: ~ $ cat example.txt |
26. Deletes the file example.txt.
1 |
pi@raspberrypi: ~ $ rm example.txt |
27. Take an image with a camera
1 |
pi@raspberrypi: ~ $ raspistill |
28. Set image width
1 |
pi@raspberrypi: ~ $ --width, -w |
29. Set image height
1 |
pi@raspberrypi: ~ $ --height, -h |
30. Take a Video with a camera
1 |
pi@raspberrypi: ~ $ raspivid |
How to install a Program
Type the following command in the terminal to install the program.
- Install a Program
1 |
pi@raspberrypi: ~ $ sudo apt-get install programname |
2. How to Install Python 3 on Raspberry Pi
1 |
pi@raspberrypi: ~ sudo apt-get install python3 |
3. How to install Python IDLE 3 on Raspberry Pi
1 |
pi@raspberrypi: ~ sudo apt-get install idle3 |
4. Shows the version of Python you currently have installed
1 |
pi@raspberrypi: ~ python |
Cheat Sheet The Raspberry Pi commands cheat sheet covers the most important and basic commands used to operate a Raspberry Pi. These include basic Linux commands, file management, and some hardware-specific commands. This cheat sheet will help you get started with the Raspberry Pi and make the most of its capabilities.
I hope you like this guide. Share it with a friend that will find it useful!
2 Comments
Pingback: How To Update Raspbian OS In 5 Steps.
Pingback: Connect Arduino To Raspberry Pi With Serial Communication