Raspberry/Orange/Nano Pi Cheatsheet

简单列一下最近常用的命令

Useful Commands

Get board revision

cat /proc/device-tree/model

Change timezone

# One line
sudo raspi-config nonint do_change_timezone "America/Toronto"

# Underhood
echo 'America/Toronto' | sudo tee /etc/timezone"
sudo rm /etc/localtime
sudo dpkg-reconfigure --frontend noninteractive tzdata

Change locale

# One line
sudo raspi-config nonint do_change_locale en_US.UTF-8

# Underhood
sed -i 's/^en_GB.UTF-8/# en_GB.UTF-8/g' /etc/locale.gen
sed -i 's/^# en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen
locale-gen
LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANGUAGE=en_US.UTF-8

Run command as another user

sudo -H -u <user> bash -c 'command' 

Play video under non-X

omxplayer -o hdmi video.h264

View image under non-X

fbi *.jpg
# For specific framebuffer
fbi -d /dev/fb0 *.jpg
# For TTY
fbi -T 1 *.jpg

Screen Related

# Power on screen
echo 0 | sudo tee /sys/class/backlight/rpi_backlight/bl_power
# Power off screen
echo 1 | sudo tee /sys/class/backlight/rpi_backlight/bl_power
# Change brightness
echo 255 | sudo tee /sys/class/backlight/rpi_backlight/brightness

Camera Related

USB Cameras

# Load v4l2
modprobe bcm2835-v4l2
# Get supported resolutions
v4l2-ctl --list-formats-ext
v4l2-ctl --list-framesizes=YU12

Motion Related

See Motion GitHub, Releases and manual

Installation

wget https://github.com/Motion-Project/motion/releases/{deb package name}
sudo apt-get install gdebi-core 
sudo gdebi {deb package name}

Video/Audio streams

# Foscam
rtsp://user:pass@IP:port/videoMain 
rtsp://user:pass@IP:port/videoSub 
rtsp://user:pass@IP:port/audio

# D-Link, audio has 65 seconds limit
http://user:pass@IP/video.cgi
http://user:pass@IP/dgaudio.cgi

# Lorex
rtsp://<IP>/<9-bit ID>.<Password>
rtsp://<IP>/012345678.Password

RPi-Monitor Related

See RPi-Monitor GitHub and manual.

Installation

# Install public key
sudo apt-get install dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
# Get apt source
sudo wget http://goo.gl/vewCLL -O /etc/apt/sources.list.d/rpimonitor.list
# Install RPi-monitor
sudo apt-get update
sudo apt-get install rpimonitor

Initial run

sudo /etc/init.d/rpimonitor update
添加新评论