The following notes are under the official Raspbian system.
Make sure you are shutting your Raspberry Pi down properly before powering it off. Type
sudo halt and wait for the Pi to signal it is ready to be powered off by flashing the activity LED. This will protect your sd card as well (ref).
Use terminal command pinout to output a reference.
The SSH server for Raspberry Pi by default isn't enabled. But it is quite easy to enable it:
Raspberry Pi Configurationfrom the
- Navigate to the
Alternatively, raspi-config can be used in the terminal:
sudo raspi-configin a terminal window
- Navigate to and select
systemctl to start the service
sudo systemctl enable ssh sudo systemctl start ssh
When enabling SSH on a Pi that may be connected to the internet, you should change its default password to ensure that it remains secure.
Enable ROOT SSH Connection
After enabling the SSH server, you can connect to your Pi via SSH:
ssh pi@<ip-address> # default password: raspberry sudo passwd root # change default root password sudo passwd --unlock root # unlock root user sudo sed -i "s/^#PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config # enable SSH login for root user sudo systemctl restart ssh # restart SSH server sudo cp ~/.bashrc /root/.bashrc # copy the same bash configuration from current user to root
After figuring the SSH, we can also use SFTP tools such as FileZilla to manage the files on the Raspberry Pi from other devices.
Monitor CPU Temperature
There are several way to get the temperature of CPU:
cat /sys/class/thermal/thermal_zone0/temp # divide the result by 10000, Celsius
To continuously monitor the temperature of the CPU, save the first command into a file name
Create Python file
monitor-temp.py by issuing following command:
import os import time def measure_temp(): temp = os.popen("vcgencmd measure_temp").readline() return (temp.replace("temp=","")) while True: print(measure_temp()) time.sleep(1)
nano monitor-temp.pyto create Python file, use
Yto save that file
This script issues the command
/opt/vc/bin/vcgencmd measure_tempevery second and print the formatted temperature in the console.
Now by running
python monitor-temp.py you can monitor the CPU Temperature every second. Further, we can also use this feature to turn on the cooling fan when CPU temperature is too high, details: Temperature Controlled Fan for Raspberry Pi 4
Change apt Sources in Mainland China
The official apt source the Raspbian uses can be extremely slow in mainland China, follow this guide to change the sources for apt:
Raspbian | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
Remember to backup two lists before editing them. Use
sudo cp <original-file-path> <backup-file-path>to backup files.
Install Chinese Keyboards
sudo apt install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4 im-config -s ibus sudo apt install ibus-pinyin ibus-sunpinyin
Then go to
iBus Preferences, add keyboards from there.
sudo apt install autojump
On Debian-based distros, manual activation is required. Add the following line to
~/.bashrc (for Bash) or
~/.zshrc (if you use zsh):