50 Essential Raspberry Pi Commands for Developers


Raspberry Pi runs a Linux-based OS (often Raspberry Pi OS), and mastering its command-line interface (CLI) gives you greater control. Below are 50 key commands with descriptions and sample outputs, formatted for quick reference.
- uname -a – (Displays kernel version and system information)
uname -a
Linux raspberrypi 5.10.63-v7l+ #1459 SMP ... armv7l GNU/Linux
- hostname – (Displays the device hostname)
hostname
raspberrypi
- ifconfig – (Displays IP address and network info)
ifconfig
eth0: inet 192.168.1.2 netmask 255.255.255.0 ...
- ip a – (Alternative to ifconfig for IP info)
ip a
inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0
- ping raspberrypi.org – (Tests network connectivity)
ping raspberrypi.org -c 2
64 bytes from ... time=30.2 ms
- df -h – (Shows disk usage in human-readable format)
df -h
/dev/root 15G 6.5G 7.5G 47% /
- free -h – (Displays memory usage)
free -h
Mem: 927Mi 215Mi 356Mi
- top – (Real-time system processes and resource usage)
top
Tasks: 106 total, 1 running, ... CPU: 5.6%us
- htop – (Advanced top viewer; requires installation)
htop
[Interactive dashboard opens]
- uptime – (Shows how long the system has been running)
uptime
14:01:00 up 3:22, 1 user, load average: 0.20, 0.18, 0.13
- sudo raspi-config – (Configuration tool for Pi settings)
sudo raspi-config
[Terminal UI appears]
- sudo reboot – (Reboots the Pi)
sudo reboot
- sudo shutdown now – (Immediate shutdown)
sudo shutdown now
- sudo apt update – (Updates package list)
sudo apt update
Fetched 10.0 MB in 15s
- sudo apt upgrade – (Installs available upgrades)
sudo apt upgrade
Upgraded 15 packages
- sudo apt install <package> – (Installs a package)
sudo apt install git
Setting up git (2.20.1-2) ...
- sudo apt remove <package> – (Removes a package)
sudo apt remove git
Removing git (2.20.1-2) ...
- ls – (Lists files in a directory)
ls
Desktop Documents Downloads
- ls -l – (Lists files with details)
ls -l
-rw-r--r-- 1 pi pi 0 Apr 10 14:00 file.txt
- cd – (Changes directory)
cd Downloads
- pwd – (Prints current directory path)
pwd
/home/pi/Downloads
- mkdir <dir> – (Creates a new directory)
mkdir test_folder
- rm <file> – (Deletes a file)
rm file.txt
- rm -r <dir> – (Deletes a directory and contents)
rm -r test_folder
- touch <file> – (Creates an empty file)
touch file.txt
- nano <file> – (Edits a file using nano editor)
nano file.txt
[Opens nano editor]
- cat <file> – (Displays file contents)
cat file.txt
Hello world
- cp <src> <dest> – (Copies file or folder)
cp file.txt backup.txt
- mv <src> <dest> – (Moves or renames file/folder)
mv file.txt newfile.txt
- chmod +x <file> – (Makes script/file executable)
chmod +x script.sh
- ./<script.sh\> – (Executes a script)
./script.sh
Running script...
- whoami – (Displays current user)
whoami
pi
- id – (Displays user ID and groups)
id
uid=1000(pi) gid=1000(pi) groups=...
- passwd – (Changes user password)
passwd
Enter new UNIX password:
- history – (Shows command history)
history
1 ls
2 cd Documents
3 nano test.txt
- clear – (Clears terminal screen)
clear
- man <command> – (Displays manual for a command)
man ls
LS(1) - list directory contents
- echo "text" – (Outputs text to terminal)
echo "Hello Raspberry Pi"
Hello Raspberry Pi
- date – (Shows current date and time)
date
Sat May 10 14:03:24 UTC 2025
- cal – (Displays calendar)
cal
May 2025
- locate <file> – (Finds file paths; may require mlocate)
locate config.txt
/boot/config.txt
- find . -name "*.py" – (Finds Python files in current dir)
find . -name "*.py"
./test.py
- grep <pattern> <file> – (Searches pattern in file)
grep "main" test.py
def main():
- wget <url> – (Downloads a file from the internet)
wget http://example.com/file.txt
- scp pi@192.168.1.5:/home/pi/file.txt . – (Copies file from another Pi)
scp pi@192.168.1.5:/home/pi/file.txt .
- ssh pi@192.168.1.5 – (Connects to another Pi remotely)
ssh pi@192.168.1.5
- vcgencmd measure_temp – (Shows CPU temperature)
vcgencmd measure_temp
temp=44.8'C
- i2cdetect -y 1 – (Scans I2C devices)
i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
- gpio readall – (Displays GPIO pin status; requires WiringPi)
gpio readall
[Table view of GPIO pin status]
- dmesg | tail – (Shows latest system messages)
dmesg | tail
[ 123.456789] USB device connected
Subscribe to my newsletter
Read articles from Chris Tiquis directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
