post:万场目前计划的一部分Ubuntu Server技巧。

This commit is contained in:
徐涛
2021-05-12 22:37:01 +08:00
parent d5f1812bc6
commit 635974eef3

View File

@@ -1,38 +0,0 @@
---
title: Ubuntu Server技巧合集
tags:
- Ubuntu
- Linux
- 操作技巧
- 常用命令
categories:
- - DevOps
- 系统管理
date: 2021.04.28 10:28
update: 2021.05.03 22:57
---
## 安装X Server
## 让Ubuntu Server启动到命令行
在为Ubuntu Server安装了X server以后再次启动Ubuntu Server会自动进入到等待登录的图形界面上如果不需要这个界面可以使用以下命令来使Ubuntu启动到命令行界面。
```bash
sudo systemctl set-default multi-user.target
```
执行完这个命令以后不要忘记使用`sudo reboot`重启机器以使配置生效,并检验命令效果。
## 阻止Ubuntu进入休眠
想要阻止Ubuntu进入休眠状态可以将用于控制休眠的服务屏蔽掉于是可以使用以下命令。
```bash
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
```
当这条命令执行成功以后,可以使用以下命令来查看当前系统的休眠状态。
```bash
systemctl status sleep.target
```