在 Debian 系统中,“message 信息”可能来自不同地方,例如:
下面按常见场景给你几种“屏蔽”方法。
Debian 登录后会显示 /etc/motd 或更新提示。
sudo rm -f /etc/motd
sudo systemctl disable motd-news.service
sudo systemctl mask motd-news.service
sudo systemctl disable apt-daily.service
sudo systemctl disable apt-daily-upgrade.service
command > /dev/null
command 2> /dev/null
command > /dev/null 2>&1
编辑:
sudo nano /etc/rsyslog.conf
例如只记录 warning 以上:
*.warning;auth,authpriv.none -/var/log/messages
重启:
sudo systemctl restart rsyslog
注释掉相关行:
#*.info;mail.none;authpriv.none;cron.none /var/log/messages
查看时屏蔽:
journalctl -p err
完全不显示某服务:
journalctl -u servicename -n 0
gsettings set org.gnome.desktop.notifications show-banners false
或卸载通知组件(谨慎):
sudo apt remove notification-daemon
编辑 GRUB:
sudo nano /etc/default/grub
添加:
GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3"
更新:
sudo update-grub
如果你能具体说明是 哪种 message(例如 apt、kernel、login、GUI、某个软件),我可以给你更精确的命令。