如何使ubuntu开机自动启动命令
时间: 2024-05-20 15:18:30 浏览: 9
要使 Ubuntu 开机自动启动命令,可以按照以下步骤进行操作:
1. 打开终端窗口。
2. 输入以下命令来打开启动应用程序设置:
sudo apt-get install gnome-session-properties
3. 在弹出的窗口中,点击“添加”按钮。
4. 在“名称”字段中输入你想要显示的名称。
5. 在“命令”字段中输入你想要自动启动的命令。
6. 点击“添加”按钮以保存设置。
现在,每次你启动 Ubuntu 时,该命令都会自动运行。
相关问题
如何使ubuntu20.04开机自动运行命令
你可以通过在Ubuntu 20.04中创建一个systemd服务来实现开机自动运行命令。请按照以下步骤操作:
1. 创建一个service文件:
```
sudo nano /etc/systemd/system/mycommand.service
```
2. 在该文件中添加以下内容:
```
[Unit]
Description=My Command
[Service]
ExecStart=/path/to/my/command
[Install]
WantedBy=multi-user.target
```
将`/path/to/my/command`替换为你想要在开机时自动运行的命令的完整路径。
3. 保存并关闭该文件。
4. 启用该服务并设置它在开机时自动启动:
```
sudo systemctl enable mycommand.service
```
5. 重启电脑,系统将会自动运行你指定的命令。
注意:确保你的命令已经可用,否则该服务可能无法启动。
ubuntu ssh开机启动命令
要在Ubuntu开机时自动启动SSH服务,可以按照以下步骤进行配置:
1. 打开终端,并以管理员身份运行。
2. 编辑SSH服务配置文件:sudo nano /etc/ssh/sshd_config
3. 找到以下行:#Start the sshd service at boot time? 默认情况下,这一行是被注释掉的。
4. 取消注释,并将值设置为“yes”:Start the sshd service at boot time? yes
5. 保存文件并关闭编辑器。
6. 启动SSH服务并使其立即生效:sudo systemctl restart sshd
现在,每次开机时,SSH服务都会自动启动。