Abyss web server - CHAPTER 13 INTRODUCING THE BASH SHELL BOOTING
CHAPTER 13 INTRODUCING THE BASH SHELL 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 Then 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. Working with Files So let s start actually using the shell. If you ve ever used DOS, then you have a head start over most shell beginners, although you ll still need to learn some new commands. Table 13-1 shows various DOS commands alongside their Ubuntu equivalents. This table also serves as a handy guide to some BASH commands, even if you ve never used DOS. In Appendix B, you ll