[ Pobierz całość w formacie PDF ] .In addition,various other programs store configuration files in/usr/lib./usr/local /usr/local is much like /usr it contains various programs andfiles not essential to the system, but which make the system fun and ex-citing.In general, programs in /usr/local are specialized for yoursystem consequently, /usr/local differs greatly between Linuxsystems./usr/man This directory contains manual pages.There are two subdirectoriesin it for every manual page section (use the command man manfor details).For example, /usr/man/man1 contains the source(that is, the unformatted original) for manual pages in section 1, and/usr/man/cat1contains the formatted manual pages for section 1./usr/src /usr/src contains the source code (the uncompiled instructions) forvarious programs on your system.The most important directory hereis /usr/src/linux, which contains the source code for the Linuxkernel./var /varholds directories that often change in size or tend to grow.Manyof those directories used to reside in /usr, but since those who sup-port Linux are trying to keep it relatively unchangeable, the directoriesthat change often have been moved to/var.Some Linux distributionsmaintain their software package databases in directories under/var./var/log /var/log contains various files of interest to the system administra-3.7.Types of shells.153tor, specifically system logs, which record errors or problems with thesystem.Other files record logins to the system as well as failed loginattempts.This will be covered in Chapter 4./var/spool /var/spool contains files which are spooled to another program.For example, if your machine is connected to a network, incoming mailis stored in/var/spool/mailuntil you read or delete it.Outgoingor incoming news articles are in/var/spool/news, and so on.3.7 Types of shells.As mentioned before, Linux is a multitasking, multiuser operating system.Multitaskingis very useful, and once you understand it, you ll use it all of the time.Before long, you llrun programs in the background, switch between tasks, and pipeline programs together toachieve complicated results with a single command.Many of the features we ll cover in this section are features provided by the shell itself.Be careful not to confuse Linux (the actual operating system) with a shell a shell is justan interface to the underlying system.The shell provides functionality inaddition to Linuxitself.A shell is not only an interpreter for the interactive commands you type at the prompt,but also a powerful programming language.It lets you to write shell scripts, to batchseveral shell commands together in a file.If you know MS-DOS you ll recognize thesimilarity to batch files.Shell scripts are a very powerful tool, that will let you automateand expand your use of Linux.See page 181 for more information.There are several types of shells in the Linux world.The two major types are the Bourne shell and the C shell.The Bourne shell uses a command syntax like the originalshell on early UNIX systems, like System III.The name of the Bourne shell on most Linuxsystems is/bin/sh(whereshstands for shell ).The C shell (not to be confused withsea shell) uses a different syntax, somewhat like the programming language C, and on mostLinux systems is named/bin/csh.Under Linux, several variations of these shells are available.The two most commonlyused are the Bourne Again Shell, or Bash (/bin/bash), and Tcsh (/bin/tcsh).bashis a form of the Bourne shell that includes many of the advanced features found inthe C shell.Because bash supports a superset of the Bourne shell syntax, shell scriptswritten in the standard Bourne shell should work with bash.If you prefer to use the Cshell syntax, Linux supportstcsh, which is an expanded version of the original C shell.154 Linux TutorialThe type of shell you decide to use is mostly a religious issue.Some folks preferthe Bourne shell syntax with the advanced features of bash, and some prefer the morestructured C shell syntax.As far as normal commands such ascpandlsare concerned,the shell you use doesn t matter the syntax is the same.Only when you start to write shellscripts or use advanced features of a shell do the differences between shell types begin tomatter.As we discuss the features of the various shells, we ll note differences between Bourneand C shells.However, for the purposes of this manual most of those differences areminimal.(If you re really curious at this point, read the man pages forbashandtcsh).3.8 Wildcards.A key feature of most Linux shells is the ability to refer to more than one file by nameusing special characters.These wildcards let you refer to, say, all file names that containthe character n.The wildcard * specifies any character or string of characters in a file name.Whenyou use the character * in a file name, the shell replaces it with all possible substitutionsfrom file names in the directory you re referencing.Here s a quick example.Suppose that Larry has the files frog, joe, and stuffinhis current directory./home/larry# lsfrog joe stuff/home/larry#To specify all files containing the letter o in the filename, use the command/home/larry# ls *o*frog joe/home/larry#As you can see, each instance of * is replaced with all substitutions that match the wild-card from filenames in the current directory.The use of * by itself simply matches all filenames, because all characters match thewildcard./home/larry# ls *frog joe stuff/home/larry#Wildcards 155Here are a few more examples:/home/larry# ls f*frog/home/larry# ls *ffstuff/home/larry# ls *f*frog stuff/home/larry# ls s*fstuff/home/larry#The process of changing a * into a series of filenames is called wildcard expansionand is done by the shell
[ Pobierz całość w formacie PDF ] zanotowane.pldoc.pisz.plpdf.pisz.plmikr.xlx.pl
|