T面板 Linux 服务器管理面板的完整命令参考,包含安装、运维、故障排查、账号管理等场景。
systemctl status tpanel
systemctl start tpanel
systemctl stop tpanel
systemctl restart tpanel
systemctl enable tpanel
systemctl disable tpanel
systemctl restart tpanel
cat /etc/nginx/sites-enabled/tpanel.conf | grep proxy_pass
cat /opt/tpanel/backend/main.py | grep version
ps aux | grep tpanel
ss -tlnp | grep 8848
sqlite3 /opt/tpanel/data/tpanel.db "SELECT value FROM settings WHERE key='panel_domain';"
cat /opt/tpanel/config/tpanel.conf
sqlite3 /opt/tpanel/data/tpanel.db "SELECT id,domain,site_path FROM sites;"
sqlite3 /opt/tpanel/data/tpanel.db "DELETE FROM admin; INSERT INTO admin(username,password_hash) VALUES('admin','');"
python3 -c "
import bcrypt, sqlite3
pw = bcrypt.hashpw(b'tpanel.cn', bcrypt.gensalt())
conn = sqlite3.connect('/opt/tpanel/data/tpanel.db')
conn.execute('DELETE FROM admin')
conn.execute('INSERT INTO admin(username,password_hash) VALUES(?,?)', ('admin', pw.decode()))
conn.commit()
print('done')
"
# 先连接数据库 sqlite3 /opt/tpanel/data/tpanel.db # 在 sqlite3 里执行(把 NEW_PASSWORD 换成你要的密码) .mode list .output stdout SELECT '请使用 Python 重置密码,参考命令:'; .quit
grep "login" /opt/tpanel/logs/*.log 2>/dev/null || sqlite3 /opt/tpanel/data/tpanel.db "SELECT * FROM security_logs WHERE event_type LIKE 'login%' ORDER BY id DESC LIMIT 10;"
systemctl status nginx
nginx -s reload
nginx -t
ls /etc/nginx/sites-enabled/
cat /etc/nginx/sites-available/你的域名.conf
rm /etc/nginx/sites-enabled/*.conf && nginx -s reload
systemctl status php*-fpm
systemctl restart php7.4-fpm systemctl restart php8.0-fpm systemctl restart php8.1-fpm systemctl restart php8.2-fpm
php -v
ls /etc/php/
systemctl status mysql
mysql -u root -p
sqlite3 /opt/tpanel/data/tpanel.db ".tables"
mysql -u root -p -e "SHOW DATABASES;"
du -sh /var/lib/mysql/
ls -lah /opt/tpanel/backups/
du -sh /opt/tpanel/backups/
sqlite3 /opt/tpanel/data/tpanel.db "SELECT id,site_id,type,size,status,datetime(created_at,'unixepoch') as created FROM backups ORDER BY id DESC LIMIT 20;"
find /opt/tpanel/backups/ -name "*.tar.gz" -mtime +30 -delete
cp /opt/tpanel/data/tpanel.db /opt/tpanel/backups/tpanel_$(date +%Y%m%d).db.bak
cp /opt/tpanel/backups/tpanel_YYYYMMDD.db.bak /opt/tpanel/data/tpanel.db && systemctl restart tpanel
sqlite3 /opt/tpanel/data/tpanel.db "SELECT domain,cert_path,expire_date FROM ssl_certs;"
openssl x509 -in /opt/tpanel/ssl/你的域名/fullchain.pem -noout -enddate
certbot renew --cert-name 你的域名
certbot certificates
ufw status
ufw status numbered
ufw allow 80/tcp ufw allow 443/tcp
ufw allow 22/tcp
ufw disable
journalctl -u tpanel -f
journalctl -u tpanel --no-pager -n 50
sqlite3 /opt/tpanel/data/tpanel.db "SELECT datetime(created_at,'unixepoch'),event_type,details,ip FROM security_logs ORDER BY id DESC LIMIT 30;"
tail -50 /opt/tpanel/logs/你的域名.access.log
tail -50 /opt/tpanel/logs/你的域名.error.log
journalctl --since '1 hour ago' --priority=err --no-pager
apt-get update && apt-get upgrade -y --only-upgrade
apt list --upgradable 2>/dev/null | grep security
top -bn1 | head -10
free -h && df -h /
crontab -l
# 停止服务 systemctl stop tpanel systemctl disable tpanel # 删除文件和配置 rm -rf /opt/tpanel rm -f /etc/nginx/sites-enabled/tpanel.conf rm -f /etc/nginx/sites-available/tpanel.conf rm -f /etc/systemd/system/tpanel.service systemctl daemon-reload
# 下载最新安装脚本 wget -O install.sh https://tpanel.cn/install.sh chmod +x install.sh bash install.sh
# 备份数据库 cp /opt/tpanel/data/tpanel.db /opt/tpanel/backups/tpanel_$(date +%Y%m%d).db.bak # 停止面板 systemctl stop tpanel # 覆盖源码(上传新版本到 /opt/tpanel) # 重启面板 systemctl restart tpanel
# 备份后执行 rm -f /opt/tpanel/data/tpanel.db cd /opt/tpanel/backend python3 db_init.py
| 命令 | 说明 |
|---|---|
| systemctl status tpanel | 查看面板状态 |
| systemctl restart tpanel | 重启面板(修改配置后必做) |
| journalctl -u tpanel -f | 实时查看面板日志 |
| nginx -t && nginx -s reload | 测试并重载 Nginx 配置 |
| sqlite3 /opt/tpanel/data/tpanel.db "SELECT * FROM sites;" | 查看所有站点 |
| sqlite3 /opt/tpanel/data/tpanel.db "SELECT * FROM security_logs ORDER BY id DESC LIMIT 10;" | 查看最近安全日志 |
| certbot certificates | 查看所有 SSL 证书 |
| ufw status | 查看防火墙状态 |
| systemctl restart nginx | 重启 Nginx |
| systemctl restart mysql | 重启 MySQL |