Chapter 7. Conquering the bash Shell

The real power of Linux lies in the shell. So, if you aspire to master Linux, you must conquer the shell. Once you’ve done so, you’ll have the ability to direct your system to do almost anything. This chapter describes the powerful bash shell. The chapter also briefly explains shell variables, shell scripts, and shell aliases, preparing you for an in-depth, continuing study of Linux and its shell.

Issuing Shell Commands

The component of Linux that interprets and executes commands is called the shell. Usually, you’ll access the shell via a terminal window, as explained in Chapter 5 and Chapter 6. However, the section “Using Virtual Consoles” later in this chapter explains how to use a virtual console. Linux supports a variety of different shells, but the most popular is the bash shell. The Linux bash shell presents the user with a Command Line Interface (CLI). CLIs are familiar to Windows users who have worked in the MS-DOS window, and indeed the Windows MS-DOS Prompt window is a kind of command-line shell. The Linux bash shell works much like the MS-DOS Prompt window; you type text commands and the system responds by displaying text replies. As your first Linux command, type w and press Enter. Your contents of the terminal window should look something like this:

 [bill@home bill]$ w
11:12am  up 6 min,  1 user,  load average: 0.00, 0.08, 0.05
USER     TTY      FROM      LOGIN@   IDLE   JCPU   PCPU  WHAT
bill     tty1              11:11am  0.00s  0.20s  0.11s  -bash

The w command tells Linux to display the system status and a list of all system users. In the example, the output of the command tells you that it’s now 11:12 a.m., that the system has been up for six minutes, and that only one user—bill—is currently logged in. Notice that the command output is very terse, packing much information into a few lines. Such output is typical of Linux commands. At first, you may find Linux output cryptic and difficult to read, but over time you’ll grow to appreciate the efficiency with which Linux communicates information.

Linux provides many commands besides the w command—so many that you may despair of learning and recalling them. Actually, the number of commands you’ll use regularly is fairly small. Soon, these will become second nature to you.

Try a second command, the date command:

[bill@home bill]$ date
Fri Oct 5 11:15:20 PST 2001

The date command displays the current date and time.

If you find working with MS-DOS distasteful or intimidating, you may not immediately enjoy working with the Linux command line. However, give yourself some time to adjust. The Linux command line has several features that make it easier to use, and more powerful, than MS-DOS.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.131.82.202