树莓派常用Command总结

发布时间:2026/10/31 1:34:30
树莓派常用Command总结

1、查看所有的网络连接

nmcli connection show

删除已经记忆的wifi

nmcli connection detele "上述show出来的Wifi名称"

2、关闭GPU渲染打开chrome浏览器

在树莓派3B+上使用chrome浏览器时,如果不禁掉gpu渲染,会卡顿严重,有多种方式关闭chrome的gpu渲染

方法1、在终端中执行如下命令

chromium --disable-gpu

方法2、复制chrome Icon到桌面
search /usr/share/applications/ to get Chromium Web Browser, copy it to ~/Desktop,then in desktop will have a new ICON

change Exec line, Exec=/usr/bin/chromium --disable-gpu --disable-software-rasterizer %U

方法3、推荐
It's better to copy chrome ICON to home/.local/share/applications make it show in start up menu
use the mv command to change name for example

mv chromium.desktop chromium-nogpu.desktop

然后再执行如下修改

change Exec line, Exec=/usr/bin/chromium --disable-gpu --disable-software-rasterizer %U

3、使用change_mirror.sh替换镜像源,the change_mirror.sh will do the automatic apt update

chmod +x change_mirror.sh sudo ./change_mirror.sh

change_mirror.sh内容如下,

#!/bin/bash echo "Backup sources..." sudo cp /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.bak sudo cp /etc/apt/sources.list.d/raspi.sources /etc/apt/sources.list.d/raspi.sources.bak echo "Replace mirror..." sudo sed -i 's|http://deb.debian.org/debian|https://mirrors.tuna.tsinghua.edu.cn/debian|g' /etc/apt/sources.list.d/debian.sources sudo sed -i 's|http://deb.debian.org/debian-security|https://mirrors.tuna.tsinghua.edu.cn/debian-security|g' /etc/apt/sources.list.d/debian.sources sudo sed -i 's|http://archive.raspberrypi.com/debian|https://mirrors.tuna.tsinghua.edu.cn/raspberrypi|g' /etc/apt/sources.list.d/raspi.sources echo "Updating apt..." sudo apt clean sudo apt update echo "Done."

如果sh脚本是在windows上进行编辑的,please firstly "sudo apt install dos2unix", then "dos2unix change_mirror.sh",finally, run "sudo ./change_mirror.sh"

4、使能,启动SSH

sudo systemctl enable ssh sudo systemctl start ssh

5、安装TailScale

curl -fsSL https://tailscale.com/install.sh | sh sudo tailscale up 查看IP tailscale ip -4

6、安装RustDesk
wget https://github.com/rustdesk/rustdesk/releases/latest/download/rustdesk-1.2.3-aarch64.deb
wget https://github.com/rustdesk/rustdesk/releases/latest/download/rustdesk-1.4.6-aarch64.deb

sudo apt install ./rustdesk-1.2.3-aarch64.deb
sudo apt install ./rustdesk-1.4.6-aarch64.deb

sudo rustdesk --service

LIBGL_ALWAYS_SOFTWARE=1 rustdesk
用RustDesk启动,记录下ID和密码

打开 RustDesk 设置:

Settings
→ Security
→ Unlock Security Settings

关闭:

Enable direct IP access

然后只允许 Tailscale IP。

这样安全性会非常高。

7、关于rpi-connect

-立即停止 sudo systemctl stop rpi-connect -关闭开机自启动 sudo systemctl disable rpi-connect 卸载命令如下 sudo apt remove rpi-connect

8、查看服务,以rpi-connect为例子

systemctl list-unit-files | grep rpi-connect(error) systemctl --user list-units | grep connect(right) systemctl --user stop rpi-connect systemctl --user disable rpi-connect

查看所有开机自启动服务

systemctl list-unit-files --type=service

9.ssh access to raspberrypi

ssh 主机名称@IP地址

10.show the type of desktop,x or wayland

echo $XDG_SESSION_TYPE

11.search vnc service

sudo systemctl status vncserver-x11-serviced

vnc function useraspi-configto configurate
the desktop need x11 type

12. How to update the “Linux kernel + raspberry pi desktop + debian”

Search current debian and raspberry pi desktop version

cat /etc/os-release # 13.2 uname -r # 6.12.47-rpt-rpi-v8

update only refreash the software list, the full-upgrade will update all of them

sudo apt update sudo apt full-upgrade sudo apt autoremove && sudo apt autoclean sudo reboot