usedtodeepincmdline"echo"myinit.sh5->u"/> usedtodeepincmdline"echo"myinit.sh5->u">

Home  >  Article  >  System Tutorial  >  How to easily switch text mode and X environment in Linux system

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

PHPz
PHPzforward
2024-01-02 13:00:181160browse

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

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!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete