Home > System Tutorial > LINUX > body text

How to easily switch text mode and X environment in Linux system

PHPz
Release: 2024-01-02 13:00:18
forward
1212 people have browsed it

linux不如redhat切换的方法,但是我们可以自行制作一个脚本,以实现这两种环境的快速切换,下面我们就来看看详细的教程。

1、在linux的桌面环境下,同时按CTRL+ALT+T打开终端。

How to easily switch text mode and X environment in Linux system

2、然后建立一个myinit.sh的脚本文件

How to easily switch text mode and X environment in Linux system

3、给myinit.sh设置可执行权限。

How to easily switch text mode and X environment in Linux system

4、用vim打开myinit.sh。

How to easily switch text mode and X environment in Linux system

5、输入如下内容:

 

if [ $# != 1 ]; then
echo "myinit.sh 3 ->used to deepin cmdline"
echo "myinit.sh 5->used to deepin X"
exit
fi
if [[ $1 == 3 ]];then
sudo systemctl disable lightdm
fiif [[ $1 == 5 ]];then
sudo systemctl disable lightdm
fi
sudo shutdown -r now
Copy after login

How to easily switch text mode and X environment in Linux system

6、如果在文本模式要进入dde桌面环境,直接执行./myinit.sh 5

How to easily switch text mode and X environment in Linux system

7、如果在dde桌面环境,进入文本模式,也可以

./myinit.sh  3

脚本中需要提升权限,所以需要输入密码。

How to easily switch text mode and X environment in Linux system

The above is the detailed content of How to easily switch text mode and X environment in Linux system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template