Summary

Serious Linux administrators must have at least a basic understanding of shell scripts. Many configuration and startup files are in fact shell scripts, and being able to read them, and perhaps modify them, will help you administer your system. Being able to create new shell scripts is also important, because doing so will help you simplify tedious tasks and create site specific tools by gluing together multiple programs to accomplish your goals. Email server administration is another task with which you must have at least a passing familiarity. Although most Linux systems don’t operate as email servers in the sense of computers whose primary duty is to handle email, most Linux installations do include email servers for processing locally generated email and sometimes to send email to outside systems or even to receive email for local users. You can configure email forwarding and perform a few other tweaks without delving too heavily into email server configuration.

The final topic of this chapter, SQL use, will help you manage simple databases stored using the SQL language. Many programs rely on SQL for their operation, so being able to perform simple SQL queries will help you work with these programs. You may even decide to set up databases to help manage your own tasks, such as tracking where you keep things in your office or home.

FAQ

What is the function of environment variables?

Environment variables are used to store information on the system for the benefit of running programs. Examples include the PATH environment variable, which holds the locations of executable programs, and HOSTNAME, which holds the system’s hostname.

How a shell script could be useful?

A shell script combines several commands, possibly including conditional expressions, variables, and other programming features, to make the script respond dynamically to a system. Therefore, a shell script can reduce administrative effort by performing a series of repetitive tasks at one command.

What is the purpose of shell aliases?

Aliases enable you to create a command “shortcut”—a simple command that can stand in for a different or longer command. Aliases are typically defined in shell startup scripts as a way to create a shortened version of a command, to have useful options for a command be used as new defaults, or to create an easier-to-remember version of a command.

What are the major SMTP servers for Linux?

Sendmail was the most common SMTP server a decade ago and is still very popular today. Postfix and Exim are often supplied as the default mail servers on modern distributions, whereas qmail is sometimes installed by administrators but isn’t the default for any major distribution. Postfix and qmail use modular designs, whereas sendmail and Exim are monolithic.

What is the difference between an email alias and email forwarding?

An email alias is configured system wide, typically in /etc/aliases. It can set up forwarding for any local address, even if that address doesn’t correspond to a real account; and if the system is properly configured, only root may edit /etc/aliases and therefore modify aliases. Email forwarding, on the other hand, is handled by the ~/.forward file in a user’s home directory; it’s intended as a means for users to control their own email forwarding without bothering the system administrator.

What is the structure of a SQL database?

Each SQL installation consists of a number of named databases, each of which in turn may contain multiple tables. Each table can be thought of as a two-dimensional array of data. Each row in a table describes some object or concept (inventory items, employees, movies in a personal DVD collection, and so on), and each column in a table holds data about these objects or concepts (model number, salary, or director, for example).

What commands are used to enter data in a SQL database?

The INSERT command inserts a single entry into a database. It requires a table name and a set of values, as in INSERT INTO movies VALUES(‘Brazil’, ‘Terry Gilliam’, 1985); . The UPDATE command can be used in a similar way to update an existing entry, but you must use SET to specify the column to set and WHERE to identify the row or rows to be modified.

What commands are used to extract data from a SQL database?

The SELECT command retrieves data from a SQL database. It can be used with a variety of additional options, such as FROM , JOIN , and WHERE , to identify the table or tables from which data should be retrieved and to locate specific values of interest.