• Aucun résultat trouvé

Overview

To start using Linux, you must know how to access your Linux system and, once you are on the system, how to execute commands and run applications. Accessing Linux involves more than just turning on your computer. Once Linux is running, you have to log into the system using a predetermined login name and password. Once on the system, you can start executing commands and running applications. You can then interact with your Linux system using either a command line interface or a graphical user interface (GUI). The Linux systems use GUI interfaces like Gnome and KDE with which you can use windows, menus, and icons to interact with your system. Most distributions, including Red Hat Linux, allow you to use a graphical login. A simple window appears with menus for selecting login options and text boxes for entering your user name and password.

Obtaining information quickly about Linux commands and utilities while logged into the system is easy. Linux has several online utilities that provide information and help. You can access an online manual that describes each command or obtain help that provides more detailed explanations of different Linux features. A complete set of manuals provided by the Linux Documentation Project is on your system and available for you to browse through or print. Both the Gnome and KDE desktops provide help systems that give you easy access to desktop, system, and application help files.

Note To make effective use of your Linux system, you must know how to configure certain features. Administrative operations such as adding users, specifying network settings, accessing CD-ROM drives, and installing software can now be performed with user-friendly system tools as well as the original command line utilities.

This chapter discusses how to access your Linux system, including logging in and out of user accounts, as well as starting the system and shutting it down. Linux commands and utilities are also covered, along with basic operations of the Gnome and KDE desktops. The chapter ends with an explanation of basic system administration operations, such as creating new user accounts and installing software packages.

User Accounts

You never directly access a Linux system. Instead, Linux sets up an interface called a shell through which you can interact. A Linux system can actually set up and operate several user shells at once, accommodating several users simultaneously. In fact, you can have many users working off the same computer running a Linux system. Each particular user appears to be the only one working on the system, as if Linux can set up several virtual computers and each user can then work on his or her own virtual computer. Such virtual computers are actually individually managed interfaces whereby each user interacts with the Linux system.

These user shells are frequently referred to as accounts. UNIX, which Linux is based on, was first used on large minicomputers and mainframes that could accommodate hundreds of users at the same time. Using one of many terminals connected to the computer, users could log into the UNIX system using their login names and passwords. All of this activity was managed by system administrators. To gain access to the system, you needed to have a user account set up for you. This was commonly known as "opening an account." A system administrator created the account on the UNIX system, assigning a login name and password for it. You then used your account to log in and use the system.

Each account is identified by a login name with access protected by a password. Of course, you can access any account if you know its login name and password. On your Linux system, you can create several accounts, logging into different ones as you choose. Other people can access your Linux system, making use of login names and passwords you provide for them.

They have their own accounts on your system. Recall that in the previous chapter on installing Linux, you created a login name and password for yourself. These are what you use to access Linux regularly. When you created the login name and password, you were actually creating a new user account for yourself.

Note You can, in fact, create other new user accounts using special system administration tools. These tools become available to you when you log in as the root user. The root user is a special user account reserved for system administration tasks, such as creating users and installing new software. Basic system administration operations are discussed briefly in Chapter 5, but they are discussed in detail in Chapters 29-39. For now, you only need your regular login name and password.

Accessing Your Linux System

To access and use your Linux system, you must carefully follow required startup and shutdown procedures. You do not simply turn off and turn on your computer. If you have installed a boot loader, either GRUB or LILO, when you turn on or reset your computer, the boot loader first decides what operating system to load and run. GRUB will display a menu of operating systems to choose, whereas LILO will display a command-line prompt, as shown here:

LILO: linux

If, instead, you wait a moment or press the ENTER key, the boot loader loads the default operating system. (Recall that earlier you designated a default operating system.) If there is a Windows system listed, you can choose to run that instead.

You can think of your Linux operating system as operating on two different levels, one running on top of the other. The first level is when you start your Linux system, and the system loads and runs. It has control of your computer and all its peripherals. You still are not able to interact with it, however. After Linux starts, it displays a login prompt, waiting for a user to come along and log into the system to start using it. To gain access to Linux, you have to log in first.

You can think of logging in and using Linux as the next level. Now you can issue commands instructing Linux to perform tasks. You can use utilities and programs such as editors or compilers, or even games. Depending on a choice you made during installation, however, you may either be interacting with the system using a simple command line interface or using the desktop directly. There are both command line login prompts and graphical login windows. In the case of most Linux distributions such as Red Hat, if you choose to use a graphical

interface at the end of the installation, you are presented with a graphical login window at which you enter your login and password. If you choose not to use the graphical interface, you are presented with a simple command line prompt to enter your login name.

Gnome Display Manager: GDM

With the graphical login, your X Window System starts up immediately and displays a login window with boxes for a user login name and a password. When you enter your login name and password, and then click the OK or GO button, your default GUI starts up. On Red Hat, this is usually Gnome.

For Red Hat, graphical logins are handled by the Gnome Display Manager (GDM). The GDM manages the login interface along with authenticating a user password and login name, and then starting up a selected desktop. If problems ever occur using the X Window System display of the GUI interface, you can force a shutdown of the X Window System and the GUI with the CTRL-ALT-BACKSPACE keys. For GUI logins, it will restart the X Window System, returning you to the login screen. Also, from the GDM, you can shift to the command line interface with the CTRL-ALT-F1 keys, and then shift back to the X Window System with the CTRL-ALT-F7 keys.

When the GDM starts up, it shows a login window with a box for login, as shown in Figure 3-1. Three menus are at the top of the window, labeled Session, Language, and System. To log in, enter your login name in the Login box and press ENTER. Then you are prompted to enter your password. Do so, and then press ENTER. By default, the Gnome desktop is then started up.

Figure 3-1: The Gnome Display Manager

When you log out from the desktop, you return to the GDM login window. To shut down your Linux system, click the System menu to display the entries Reboot or Halt. Select Halt to shut down your system. Alternatively, you can also shut down when you log out from Gnome.

Gnome will display a logout screen with the options to log out, shut down, or reboot. Logout is the default, but selecting Shutdown will also shut down your system. Selecting reboot will shut down and restart your system. (You can also open a terminal window and enter the shutdown, halt, or reboot commands as described in the next section. Halt will log out and shut down your system.)

From the Session menu, you can select the desktop or window manager you want to start up.

Figure 3-2 shows the default entries for Red Hat's Session menu. Here you can select KDE to start up the K Desktop instead of Gnome, among others. The Language menu lists a variety of different languages Red Hat Linux supports. Choose one to change the language interface.

Figure 3-2: GDM Sessions menu Command Line Interface

For the command line interface, you are initially given a login prompt. The system is now running and waiting for a user to log in and use it. You can enter your user name and password to use the system. The login prompt is preceded by the hostname you gave your system. In this example, the hostname is turtle. When you finish using Linux, you first log out. Linux then displays exactly the same login prompt, waiting for you or another user to log in again. This is the equivalent of the login window provided by the GDM. You can then log into another account.

Red hat Linux release 7.2 (Enigma) Kernel 2.4.7-10 on i686

turtle login:

If you want to turn off your computer, you must first shut down Linux. If you don't shut down Linux, you could require Linux to perform a lengthy systems check when it starts up again.

You shut down your system in either of two ways. First, log into an account and then enter the halt command. This command will log you out and shut down the system.

$ halt

Alternatively, you can use the shutdown command with the -h option. With the -r option, it shuts down the system and then reboots it. In the next example, the system is shut down after five minutes. To shut down the system immediately, you can use +0 or the word now (see Chapter 29 for more details).

# shutdown -h now

Note Shutting down involves a series of important actions, such as unmounting file systems and shutting down any servers (never simply turn off the computer).

You can also reboot your system from the login prompt. Logging out does not shut down the system: it is still running and has control of your machine. To shut down and reboot your system, hold down the CTRL and ALT keys, and then press the DEL key (CTRL-ALT-DEL).

You system will go through the standard shutdown procedure and then reboot your computer.

At this point it is safe to turn off your computer if you wish, or just let the system restart.

When you shut down, you will see several messages as Linux shuts itself down. It is not finished until you see the "System is halted" message. If you are rebooting, Linux will shut down and then reboot your system, at which time you can turn it off if you wish. The following steps include all the startup and shutdown procedures for the command line interface:

1. Boot your computer.

2. At the boot loader, make sure the "linux" entry is selected and press ENTER. (Or, press ENTER if Linux is your default.)

3. After a few messages, the login prompt appears, and then you can log into the system and use it.

4. When you finish working in an account, you can log out. The login prompt then reappears, and you can log into another account.

5. If you are finished working on Linux and want to shut it down, enter the halt command while still logged into your account (shutdown -r will reboot).

6. At the login prompt, you can also shut down and reboot the system with CTRL-ALT-DEL. The system first shuts down and then restarts, at which time you can turn off your computer or just let the system start up again.

Once you log into an account, you can enter and execute commands. Logging into your Linux account involves two steps: entering your user name, and then your password. You already know what the login prompt looks like. Type in the login name for your user account. If you make a mistake, you can erase characters with the BACKSPACE key. In the next example, the user enters the user name richlp and is then prompted to enter the password:

Red hat Linux release 7.2 (Enigma) Kernel 2.4.7-10 on i686

turtle login: richlp Password:

When you type in your password, it does not appear on the screen. This is to protect your password from being seen by others. If you enter either the login or password incorrectly, the system will respond with the error message "Login incorrect" and will ask for your login name again, starting the login process over. You can then reenter your login name and password.

Once you enter your user name and password correctly, you are logged into the system. Your command line prompt is displayed, waiting for you to enter a command. Notice the command line prompt is a dollar sign ($), not a sharp sign (#). The $ is the prompt for regular users, whereas the # is the prompt solely for the root user. In this version of Linux, your prompt is preceded by the hostname and the directory you are in. Both are bounded by a set of brackets.

[turtle /home/richlp]$

To end your session, issue the logout or exit commands. This returns you to the login prompt, and Linux waits for another user to log in.

[turtle /home/richlp]$ logout

Once logged into the system, you have the option of starting an X Window System GUI, such as Gnome or KDE, and using it to interact with your Linux system. In Linux, the command startx starts the X Window System along with a GUI, which then enables you to interact with the system using windows, menus, and icons. On Red Hat, the startx command starts the Gnome desktop by default, though you can configure it to start up another desktop such as KDE or even a window manager. Once you shut down the GUI interface, you will return to your command line interface, still logged in.

On Red Hat, you can use the switchdesk command, while in your desktop, to switch between Gnome, KDE, or the FVWM window manager. You make your selection and then quit the desktop to return to the command line interface. When you start up the GUI again, the desktop you selected is used.

Gnome Desktop

The Gnome desktop display shown in Figure 3-3 initially displays a panel at the bottom of the screen, as well as any icons for folders and Web pages initially set up by your distribution.

For Red Hat, you see several Web page icons and a folder for your home directory. The panel at the bottom of the screen contains icons for starting applications, such as Mozilla (the Mozilla logo) and the Help system (the question mark logo). You can start applications using the main menu, which you display by clicking the Gnome icon (the image of a bare footprint), located on the left side of the panel.

Figure 3-3: Gnome

When you click the folder for your home directory on your desktop or select the File Manager entry on the main menu, a file manager window opens showing your home directory. You can display files in your home directory and use the UP ARROW button to move to the parent directory. Back and Forward buttons move through previously displayed directories. In the location window, you can enter the pathname for a directory to move directly to it. The file manager is also Internet-aware. You can use it to access remote FTP directories and to display or download their files (though it cannot display Web pages).

To move a window, left-click and drag its title bar or right-click its other borders. Each window supports Maximize, Minimize, and Close buttons, as well as a Stick Pin button.

Double-clicking the title bar will "shade" a window, or rather reduce it to only its title bar;

you can redisplay the window with another double-click. The desktop supports full drag-and-drop capabilities. You can drag folders, icons, and applications to the desktop or other file manager windows open to other folders. The move operation is the default drag operation. To

copy files, click and drag, and then press the CTRL key before releasing the mouse button. To create links, hold down the SHIFT key when you click and drag. In most cases, you would use links for desktop icons.

The panel also contains a pager for desktop areas, which appears as four squares. Clicking a square moves you to that area. You can think of the desktop work area as being four times larger than your monitor screen, and you can use the pager to display different parts. You can configure your Gnome interface, setting features such as the background, by using the

Preferences window in the Start Here window. Click the image of a compass with a map on the panel to open the Start Here window (see Figure 3-3). To configure system settings, such as adding users, installing printers, and setting up network connections, open the System Settings window in the Start Here window (see Figure 3-4). To execute a command using the command line interface, open a terminal window by clicking the image of a monitor on the panel. In that window, at the $ prompt, type in your command.

Figure 3-4: Desktop Switcher

To quit the Gnome desktop, select the logout entry at the bottom of the main menu. If you entered from a login window, you are then logged out of your account and returned to the login window. If you started Gnome from the command line, you are returned to the command line prompt, still logged into your account.

Although Gnome is the default desktop for Red Hat, you can easily switch to the KDE desktop. Red Hat installs the complete KDE desktop as part of its distribution. If you are

Although Gnome is the default desktop for Red Hat, you can easily switch to the KDE desktop. Red Hat installs the complete KDE desktop as part of its distribution. If you are