Handy Raspberry Pi Commands
cheat sheet of tips mainly for headless RPI
First time set up
default password for “pi” is “raspberry”
First time set up:
sudo apt-get update && sudo apt-get upgrade
sudo shutdown -h now
ssh into the pi:
copy files to pi:
scp filename firstname.lastname@example.org:~/destination/foldername/
copy files From pi:
scp email@example.com:~/source/file /destination/directory/
VNC - desktop sharing
install VNC: https://www.raspberrypi.org/documentation/remote-access/vnc/
start a vnc server:
vncserver :0 -geometry 800x600 -depth 16
vncserver -kill :0
check network config and get ip address:
sudo nano /etc/network/interfaces
sudo nano /etc/rc.local
Mount USB drive
- plug in the usb drive
- find what the drive is called with
ls -l /dev/disk/by-uuid/, normally it will be /sda1
- create a directory to connect to the drive, i.e. a mount point:
sudo mkdir /media/usb
- make the main user, i.e.
pi, the owner of the mount point:
sudo chown -R pi:pi /media/usb
- mount the drive:
sudo mount /dev/sda1 /media/usb -o uid=pi,gid=pi(replace /dev/sda1 with your actual drive name if it is not the usual setup)
Use a HDMI to VGA adapter
If you are trying to use an HDMI to VGA adapter, the pi will not detect the HDMI screen and will default to using composite video only.
You need to edit your
/boot/config.txt file on the pi’s SD card to manually tell it to use HDMI.
See eLinux RPiconfig for full info about config.txt.
- Put your pi’s SD card in a computer’s card reader.
- Find config.txt in the boot directory (which will likely be the only thing you can see from your computer).
/boot/config.txtin an editor.
- Uncomment the line
On rpi2 with the newest version of Raspbian Stretch, you can enable a new hardware OpenGL driver.
sudo raspi-config, look in Advanced > GL Driver.
Select the new driver, then select finish and reboot the pi.
Try it out with a few OpenGL games:
sudo apt-get install neverball
sudo apt-get install oolite