Raspberry Pi CheatSheet

Various commands to get information about your pi. There are thousands of articles out there, these are just my notes. I will continually add to this.

Raspbian and PI OS are based on Debian (so is ubuntu), so many of these commands will apply to those distros as well.

Assumptions

  • You are familiar with SSH
  • You are familiar with Terminal
  • You can find your Pi

Command Prompt or Terminal Prompt

pi@raspberrypi:~ $               <<< throughout this we are assuming you have a terminal session started.

Physically Read the Processor on the Board

Raspberry Pi Family Processor Label
RPi 4 and 400 2711
RPi 3 2837
RPi 2 2836 or 2837
RPi (1) 2835
RPi Zero 2835
RPi Pico Raspberry Pi logo

 

Command Description
Files / navigation  
ls   (ls -a) list files in the current or named directory -a for all files.
sudo nano command line test editor
cd change from the current directory cd . (back one folder) - cd ~ (user home) - cd / (root)
cp  copy a file eg cp /downloads/file.txt /myfolder/file.txt
mv move a file eg mv /downloads/file.txt /myfolder/file.txt
mkdir create folder mkdir newfolder
rmdir remove folder use -r (with caution recursive removes all sub folders and files)
pwd display current folder
rm remove file
tar -xvzf filename extractfolder. uncompress a file can put filename and a path to the extract folder.
who display the user you are.
   
System Updates / Installs / Control  
cat /sys/firmware/devicetree/base/model pi model information
cat /proc/cpuinfo processor information
lspci  chip and bus information
sudo -i  ( prompt changes to #, type 'exit' to escape) puts you in sudo  ( super user do or admin mode) interactive - so you don't have to put sudo in front of system commands
sudo raspi-config Takes you to the Configuration screen to turn on SSH, change resolution, consume the rest of disk space, dedicate more space to video memory etc..
sudo apt update gets a list of updates to packages
sudo apt upgrade performs updates on packages
sudo apt  there are various other options and commands can be combined on completion of first command eg sudo apt update && sudo apt upgrade -y
sudo apt install  package used to install other applications
sudo apt remove package used to remove package.
lsusb see what usb devices are connected
   
Network  
ifconfig Network Interface information
iwconfig WiFi Interface information
   
User and Permissions  
sudo adduser newuser sudo this would add newuser with permissions to sudo.
sudo cat /etc/sudoers.d/