查看debian电脑开机启动项,并禁用多余的开机项
查看debian电脑开机启动项,并禁用多余的开机项

查看debian电脑开机启动项,并禁用多余的开机项

debian

在 Debian 系统中查看和管理开机启动项,可以通过以下几种方法:

一、查看所有启动服务(系统级)

# 查看所有系统服务(含启动状态)
sudo systemctl list-unit-files --type=service | grep enabled

# 或查看已激活的服务
sudo service --status-all | grep '+'

二、查看用户级启动项

1. 系统全局启动项

# 查看 /etc/rc.local(传统方式)
cat /etc/rc.local

# 查看 Systemd 启动项
ls -lh /etc/systemd/system/multi-user.target.wants/

2. 当前用户启动项

# 查看 ~/.config/autostart/ 目录
ls -lh ~/.config/autostart/

# 或检查 crontab 中的 @reboot 任务
crontab -l | grep '@reboot'

三、使用图形化工具(可选)

# 安装 rcconf(需 root 权限)
sudo apt install rcconf
sudo rcconf

四、禁用不需要的启动项

# 禁用某个服务(如示例服务)
sudo systemctl disable servicename.service

# 启用某个服务
sudo systemctl enable servicename.service

五、其他可能存放启动项的位置

  1. /etc/init.d/ 目录(旧式 SysV 脚本)
  2. /etc/xdg/autostart/ 图形界面自动启动
  3. ~/.bashrc~/.profile(用户登录时执行)

六、检查启动耗时

# 查看系统启动耗时
systemd-analyze blame

# 查看详细的启动时间线
systemd-analyze critical-chain

通过以上方法,您可以全面掌握 Debian 系统的启动项情况,并及时禁止多余启动项,以免影响开始速度和不必要的麻烦。


了解 CodeCoding 的更多信息

订阅后即可通过电子邮件收到最新文章。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注