50 Essential Raspberry Pi Commands for Developers

Chris TiquisChris Tiquis
4 min read

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.


  1. uname -a – (Displays kernel version and system information)
uname -a

Linux raspberrypi 5.10.63-v7l+ #1459 SMP ... armv7l GNU/Linux

  1. hostname – (Displays the device hostname)
hostname

raspberrypi

  1. ifconfig – (Displays IP address and network info)
ifconfig

eth0: inet 192.168.1.2 netmask 255.255.255.0 ...

  1. ip a – (Alternative to ifconfig for IP info)
ip a

inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0

  1. ping raspberrypi.org – (Tests network connectivity)
ping raspberrypi.org -c 2

64 bytes from ... time=30.2 ms

  1. df -h – (Shows disk usage in human-readable format)
df -h

/dev/root 15G 6.5G 7.5G 47% /

  1. free -h – (Displays memory usage)
free -h

Mem: 927Mi 215Mi 356Mi

  1. top – (Real-time system processes and resource usage)
top

Tasks: 106 total, 1 running, ... CPU: 5.6%us

  1. htop – (Advanced top viewer; requires installation)
htop

[Interactive dashboard opens]

  1. 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

  1. sudo raspi-config – (Configuration tool for Pi settings)
sudo raspi-config

[Terminal UI appears]

  1. sudo reboot – (Reboots the Pi)
sudo reboot
  1. sudo shutdown now – (Immediate shutdown)
sudo shutdown now
  1. sudo apt update – (Updates package list)
sudo apt update

Fetched 10.0 MB in 15s

  1. sudo apt upgrade – (Installs available upgrades)
sudo apt upgrade

Upgraded 15 packages

  1. sudo apt install <package> – (Installs a package)
sudo apt install git

Setting up git (2.20.1-2) ...

  1. sudo apt remove <package> – (Removes a package)
sudo apt remove git

Removing git (2.20.1-2) ...

  1. ls – (Lists files in a directory)
ls

Desktop Documents Downloads

  1. ls -l – (Lists files with details)
ls -l

-rw-r--r-- 1 pi pi 0 Apr 10 14:00 file.txt

  1. cd – (Changes directory)
cd Downloads
  1. pwd – (Prints current directory path)
pwd

/home/pi/Downloads

  1. mkdir <dir> – (Creates a new directory)
mkdir test_folder
  1. rm <file> – (Deletes a file)
rm file.txt
  1. rm -r <dir> – (Deletes a directory and contents)
rm -r test_folder
  1. touch <file> – (Creates an empty file)
touch file.txt
  1. nano <file> – (Edits a file using nano editor)
nano file.txt

[Opens nano editor]

  1. cat <file> – (Displays file contents)
cat file.txt

Hello world

  1. cp <src> <dest> – (Copies file or folder)
cp file.txt backup.txt
  1. mv <src> <dest> – (Moves or renames file/folder)
mv file.txt newfile.txt
  1. chmod +x <file> – (Makes script/file executable)
chmod +x script.sh
  1. ./<script.sh\> – (Executes a script)
./script.sh

Running script...

  1. whoami – (Displays current user)
whoami

pi

  1. id – (Displays user ID and groups)
id

uid=1000(pi) gid=1000(pi) groups=...

  1. passwd – (Changes user password)
passwd

Enter new UNIX password:

  1. history – (Shows command history)
history

1 ls

2 cd Documents

3 nano test.txt

  1. clear – (Clears terminal screen)
clear
  1. man <command> – (Displays manual for a command)
man ls

LS(1) - list directory contents

  1. echo "text" – (Outputs text to terminal)
echo "Hello Raspberry Pi"

Hello Raspberry Pi

  1. date – (Shows current date and time)
date

Sat May 10 14:03:24 UTC 2025

  1. cal – (Displays calendar)
cal

May 2025

  1. locate <file> – (Finds file paths; may require mlocate)
locate config.txt

/boot/config.txt

  1. find . -name "*.py" – (Finds Python files in current dir)
find . -name "*.py"

./test.py

  1. grep <pattern> <file> – (Searches pattern in file)
grep "main" test.py

def main():

  1. wget <url> – (Downloads a file from the internet)
wget http://example.com/file.txt
  1. 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 .
  1. ssh pi@192.168.1.5 – (Connects to another Pi remotely)
ssh pi@192.168.1.5
  1. vcgencmd measure_temp – (Shows CPU temperature)
vcgencmd measure_temp

temp=44.8'C

  1. 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 -- -- --

  1. gpio readall – (Displays GPIO pin status; requires WiringPi)
gpio readall

[Table view of GPIO pin status]

  1. dmesg | tail – (Shows latest system messages)
dmesg | tail

[ 123.456789] USB device connected

0
Subscribe to my newsletter

Read articles from Chris Tiquis directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Chris Tiquis
Chris Tiquis