文章目录[隐藏]
查看文件夹总大小:
bash
# 最常用:查看当前目录总大小
du -sh
# 查看指定目录(如 /mnt/data)
du -sh /mnt/data
# 查看当前目录下所有子目录大小(排序)
du -h --max-depth=1 | sort -hr
# 查看 /mnt/data 下各子目录详情
du -sh /mnt/data/* 2>/dev/null | sort -hr
1. 创建 rc.local 文件
bash
sudo tee /etc/rc.local << 'EOF'
#!/bin/bash
# 开机自启动脚本
# 添加你的命令到这里
exit 0
EOF
sudo chmod +x /etc/rc.local
2. 创建 systemd 服务
bash
sudo tee /etc/systemd/system/rc-local.service << 'EOF'
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF
3. 启用并启动
bash
sudo systemctl daemon-reload
sudo systemctl enable rc-local
sudo systemctl start rc-local
sudo systemctl status rc-local
4. 验证日志
bash
sudo journalctl -u rc-local







