免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 906 | 回复: 0
打印 上一主题 下一主题

Running the Shell via a Virtual Console [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-05-08 12:51 |只看该作者 |倒序浏览
As noted earlier, you can start the shell in a number of ways. The most common way among Linux diehards is via a virtual console. To access a virtual console, press Ctrl+Alt, and then press one of the function keys from F1 through F6 (the keys at the top of your keyboard).
Using a virtual console is a little like switching desks to a completely different PC. Pressing Ctrl+Alt+F1 will cause your GUI to disappear, and the screen to be taken over by a commandline prompt (don’t worry; your GUI is still there and running in the background). You’ll be asked to enter your username and your password.
Any programs you run in a virtual console won’t affect the rest of the system, unless they’re system commands. One way to rescue a crashed GUI program is to switch to a virtual console and attempt to terminate the program from there.)

You can switch back to the GUI by pressing Ctrl+Alt+F7. Don’t forget to quit your virtualconsole when you’re finished with it, by typing exit.

BOOTING INTO THE SHELL
If you’re really in love with the shell, you can choose to boot into it, avoiding the GUI completely (although you can later start the GUI by typing startx at the command line).

Booting into the shell is done by defining a custom run level. A run level is how the operating mode that Ubuntu is currently running in is described. For example, one particular run level might start a GUI, while another might start only a command prompt.

There are usually seven run levels under Linux, numbered from 0 to 6. Not all of them do something interesting. On Ubuntu, run levels 2 through 5 are all the same. Each runs the GUI. Run level 1 runs a command prompt, so it might seem ideal for booting into the shell, but it also shuts down a few essential services. This
means it isn’t suitable for day-to-day use.

The trick is to take one of the existing run levels and alter it slightly so that it doesn’t run a GUI by default.On many distributions, run level 3 is reserved for this purpose, so it makes sense to alter it under Ubuntu. (For what it’s worth, the default Ubuntu run level is 2.)

Stopping Ubuntu from running a GUI upon booting is simply a matter of stopping the program that appears when Ubuntu boots—GDM. This provides the login window that appears and starts the whole graphical subsystem. Type the following command at the shell to remove the shortcut to GDM within the run level 3
configuration:

sudo rm /etc/rc3.d/S13GDM

After this, you’ll need to tell Ubuntu to boot straight to run level 3, rather than the default of 2. You do this by editing the /etc/inittab file, which is one of the first configuration files Ubuntu reads when booting.
Issue the following command at the shell to open the file in the Gedit text editor:

sudo gedit /etc/inittab

Then look for the following line, which will be near the top of the file:
id:2:initdefault
And edit it so that it reads:
id:3:initdefault
T
hen save the file. From now on, you’ll always boot straight to a BASH prompt. To restore things to the way they were, simply restore the line in the /etc/inittab file to the way it appeared originally.

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/35601/showart_294318.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP