Skip to content

Instantly share code, notes, and snippets.

@hofmannsven
Last active August 27, 2024 09:08
Show Gist options
  • Save hofmannsven/9132419 to your computer and use it in GitHub Desktop.
Save hofmannsven/9132419 to your computer and use it in GitHub Desktop.
Raspberry Pi Cheatsheet

Raspberry Pi

Setup

Find all available devices arp -a

Locate Raspberry (b8:27:eb) in Network: Pi Finder

SSH

  • Connect to device via SSH + Name: ssh pi@rasperrypi
  • Connect to device via SSH + IP: ssh pi@192.168.64.xxx

Users

Add new user with home dir: sudo useradd -m sven -G sudo (see /etc/passwd)

Set password for user: sudo passwd sven (see /etc/shadow)

System

Get system info (e.g. IP): ifconfig

Get network info: iwconfig

Get hostname: hostname

Get hostname IP: hostname -I

Check for all connected USB devices: lsusb

Switch to config: sudo raspi-config

Switch to GUI: startx

Reboot system: reboot / sudo reboot

Shutdown: sudo shutdown -h now

Start SSH while booting: sudo update-rc.d ssh defaults

Web Server

Update system: sudo apt-get update && sudo apt-get upgrade

Install Web Server: sudo apt-get install apache2 php5

Laravel will also need mcrypt and GD extension.

Install MySQL: sudo apt-get install mysql-server mysql-client php5-mysql

Restart: sudo service apache2 restart

Install Avahi for .local domain: sudo apt-get install avahi-daemon (see tutorial)

Note: Also update vhosts to AllowOverride All!

Audio

Play: omxplayer audio.mp3

Volume: + & -

GUI Keyboard Shortcuts

System menu: ctrl + esc

Open programm menu: alt + space

Switch programms: alt + tab

Access dropdown: alt + [letter-with-underline] e.g. alt + f

Close window: ctrl + q

Back to CLI: ctrl + alt + backspace

Remote Control

Install XRDP: apt-get install xrdp

Connect via Remote Desktop app


File Sharing

Install file sharing: sudo apt-get install netatalk

Connect to Server (via ⌘K): afp://192.168.64.xxx

Wifi

Setup

Disable Power Management

  • Tutorial

  • Check the power management flag using: cat /sys/module/8192cu/parameters/rtw_power_mgnt (this will report a value of 1)

  • To set it to zero you can use: sudo touch /etc/modprobe.d/8192cu.conf

  • Add this line to the created file: options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

  • Reboot: sudo reboot

Midnight Commander

Install: sudo apt-get install mc

Start: sudo mc

@Onik97
Copy link

Onik97 commented Feb 6, 2019

This is perfect! Thank you

@Schokostoffdioxid
Copy link

Awesome, Thank You! ^^

@fbotello
Copy link

Really needed this! Thank you! ^^^

@PopsfromMI
Copy link

this will save hours of search and hassle. You've done a very generous thing with this, Thankx.

@andrew-social
Copy link

Under Web Server:
Update system: sudo apt-get update & sudo apt-get upgrade
You accidentally left out an "&"
SB: sudo apt-get update && sudo apt-get upgrade
Two & means run the following command if the previous command exited with error code 0, no error.
One & means run the following command in the background.

I love your cheatsheet, I am adding to it to make my own.

@hofmannsven
Copy link
Author

@andrew-social Thanks for pointing this out. It was meant as two separate commands, but I updated it to make it more clear.

@xgqfrms
Copy link

xgqfrms commented Jul 15, 2022

not work for pi 3B

not found cat /sys/module/8192cu/parameters/rtw_power_mgnt

eric@rpi4b:~ $ cat /sys/module/8192cu/parameters/rtw_power_mgnt
cat: /sys/module/8192cu/parameters/rtw_power_mgnt: 没有那个文件或目录

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment