. . Читать онлайн. Newlib. NEWLIB.NET

Автор:
Издательство:
Серия:
Жанр произведения:
Год издания:
isbn:
Скачать книгу
desktop experience.

      Besides GNOME desktops, you can try out other popular and useful desktop environments. The K Desktop Environment (KDE) offers many more bells and whistles than GNOME and is used by default in several Linux distributions. Netbooks and live CD distributions sometimes use the LXDE or Xfce desktops.

      Now that you have a grasp of how to get and use a Linux desktop, it's time to start digging into the more professional administrative interfaces. Chapter 3 introduces you to the Linux command-line shell interface.

      Exercises

      Use these exercises to test your skill in using a GNOME desktop. You can use either a GNOME 2.x (Red Hat Enterprise Linux up until RHEL 6.x) or GNOME 3.x (Fedora 16 or later or Ubuntu up to 11.10, or later using the Ubuntu GNOME project) desktop. If you are stuck, solutions to the tasks for both the GNOME 2 and GNOME 3 desktops are shown in Appendix B.

      1. Obtain a Linux system with either a GNOME 2 or GNOME 3 desktop available. Start the system, and log in to a GNOME desktop.

      2. Launch the Firefox web browser, and go to the GNOME home page (http://gnome.org).

      3. Pick a background you like from the GNOME art site (http://gnome-look.org/), download it to your Pictures folder, and select it as your current background.

      4. Start a Nautilus File Manager window, and move it to the second workspace on your desktop.

      5. Find the image you downloaded to use as your desktop background, and open it in any image viewer.

      6. Move back and forth between the workspace with Firefox on it and the one with the Nautilus file manager.

      7. Open a list of applications installed on your system, and select an image viewer to open from that list. Use as few clicks or keystrokes as possible.

      8. Change the view of the windows on your current workspace to smaller views of those windows you can step through. Select any window you like to make it your current window.

      9. From your desktop, using only the keyboard, launch a music player.

      10. Take a picture of your desktop, using only keystrokes.

Part II

      Becoming a Linux Power User

Chapter 3

      Using the Shell

      Before icons and windows took over computer screens, you typed commands to interact with most computers. On UNIX systems, from which Linux was derived, the program used to interpret and manage commands was referred to as the shell.

      No matter which Linux distribution you are using, you can always count on the fact that the shell is available to you. It provides a way to create executable script files, run programs, work with filesystems, compile computer code, and manage the computer. Although the shell is less intuitive than common graphic user interfaces (GUIs), most Linux experts consider the shell to be much more powerful than GUIs. Shells have been around a long time, and many advanced features that aren't available from the desktop can be accessed by running shell commands.

      The Linux shell illustrated in this chapter is called the bash shell, which stands for Bourne Again Shell. The name is derived from the fact that bash is compatible with the one of the earliest UNIX shells: the Bourne shell (named after its creator Stephen Bourne, and represented by the sh command).

      Although bash is included with most distributions, and considered a standard, other shells are available, including the C shell (csh), which is popular among BSD UNIX users, and the Korn shell (ksh), which is popular among UNIX System V users. Ubuntu uses the dash shell, by default, which is designed to perform faster than the bash shell. Linux also has a tcsh shell (an improved C shell) and an ash shell (another Bourne shell look-alike).

      The odds are strong that the Linux distribution you are using has more than one shell installed by default and available for your use. This chapter, however, focuses primarily on the bash shell. That is because the Linux distributions featured in this book, Fedora and Red Hat Enterprise Linux, both use the bash shell by default. The bash shell can also easily be added to Ubuntu.

      The following are a few major reasons to learn how to use the shell:

      ● You will know how to get around any Linux or other UNIX-like system. For example, I can log in to my Red Hat Enterprise Linux web server, my home multimedia server, my home router, or my wife's Mac and explore and use any of those computer systems from a shell. I can even log in and run commands on my Android phone. They all run Linux or similar systems on the inside.

      ● Special shell features enable you to gather data input and direct data output between commands and the Linux filesystem. To save typing, you can find, edit, and repeat commands from your shell history. Many power users hardly touch a graphical interface, doing most of their work from a shell.

      ● You can gather commands into a file using programming constructs such as conditional tests, loops, and case statements to quickly do complex operations that would be difficult to retype over and over. Programs consisting of commands that are stored and run from a file are referred to as shell scripts. Most Linux system administrators use shell scripts to automate tasks such as backing up data, monitoring log files, or checking system health.

      The shell is a command language interpreter. If you have used Microsoft operating systems, you'll see that using a shell in Linux is similar to – but generally much more powerful than – the interpreter used to run commands in DOS or in the CMD command interface. You can happily use Linux from a graphical desktop interface, but as you grow into Linux you will surely need to use the shell at some point to track down a problem or administer some features.

      How to use the shell isn't obvious at first, but with the right help you can quickly learn many of the most important shell features. This chapter is your guide to working with the Linux system commands, processes, and filesystem from the shell. It describes the shell environment and helps you tailor it to your needs.

      About Shells and Terminal Windows

      There are several ways to get to a shell interface in Linux. Three of the most common are the shell prompt, Terminal window, and virtual console, which you learn more about in the following sections.

      To start using this section, boot up your Linux system. On your screen, you should either see a plain-text login prompt similar to the following:

      Or you will see a graphical login screen.

      In either case, you should log in with a regular user account. If you have a plain-text login prompt, continue to the “Using the shell prompt” section. If you log in through a graphical screen, go to the “Using a terminal window” section to see how to access a shell from the desktop. In either case, you can access more shells as described in the “Using virtual consoles” section.

      Using the shell prompt

      If your Linux system has no graphical user interface (or one that isn't working at the moment), you will most likely see a shell prompt after you log in. Typing commands from the shell will probably be your primary means of using the Linux system.

      The default prompt for a regular user is simply a dollar sign:

      The default prompt for the root user is a pound sign (also called a hash mark):

      In most Linux systems, the $ and # prompts are preceded by your username, system name, and current directory name. For example, a login prompt for the user named jake on a computer named pine with /usr/share/ as the current working directory would appear as

      You