Presentation on theme: "Pace Center for Business and Technology"— Presentation transcript:
1Pace Center for Business and Technology Welcome to RHA030Pace Center for Business and Technology1
2Introduction RHA030 – Computing Essentials Pace Center for Business and Technology
3Introduction RHA030 – Computing Essentials AudienceUsers who are new to Linux and have no prior UNIX or command-line skills, who want to develop and practice the basic skills to use and control their own Red hat Linux system.Assumed KnowledgeUser-level experience with any computer system, use of mouse, use of menus, use of any graphical user interface.AimsStudents will learn to be effective users of Linux systems, acquiring skills and understanding of command line functions, file systems, users and groups, bash shell, process management, text editors, network applications, searching and organizing data, and graphical applications.ObjectivesUpon successful completion of this curse, the student will be a Red Hat Linux user productive in using and customizing a Red Hat Linux system for common command line processes and desktop productivity roles.
4Classroom Environment Computers are equipped with Red Hat Enterprise Linux 6The setup:Instructor computer – Primary classroom server:cifs-file-server (Common Internet File System)directory-serverftp-servernetwork-servernfs-file-serverweb-serverStudent computers – Red Hat Client Workstations:VMWare PlayerA VM for each course RHEL6-030, RHEL6-130, and RHEL6-230/250For this class we will be using the RHEL The VM has all the required software to facilitate your learning and experience of the Red Hat Enterprise Linux OS.
6Classroom Environment Virtual Machine VMs must be shut down via the normal “System Shutdown” after class ends to avoid confusion for the next class.Do not click “X” on a VM once opened – it will put it in Suspend mode and will take a very long time when re-openingOnce you open the VM player via the “Student” account (password = redhat), you will see three VM options:RHEL6 030RHEL6 130RHEL 230/250Select the RHEL6 030030 VM is a preconfigured VM with RHEL already installed; is ready to go for an 030 class (it has base and student RPMs installed). A suggestion is to have the students change the view to Full Screen so they don’t get confused with the double menus on top of the screen (Host and VM)
7Red Hat Academy Curriculum Structure Red Hat Academy curriculum is structured enough to be programmatically managed, but flexible enough to present information in a manner that promotes effective learning by the student. The following sections describe the design elements that will become familiar to users of Red Hat Academy.
8Red Hat Academy Curriculum Structure Red Hat Academy courses draw from our corporate training courses, but greatly expands the material with many examples and exercises to provide a semester-long course appropriate for the academic environment.Courses:Currently, the following courses are offered through Red Hat Academy, with more to be offered in the future.RHA030: Red Hat Enterprise Linux ComputingEssentials (10 workbooks)RHA130: Red Hat Enterprise Linux Core SystemAdministration (10 workbooks)RHA230: Red Hat Enterprise Linux NetworkApplications (6 workbooks)RHA250: Red Hat Linux Security Administration (4workbooks)Workbooks:RHA courses consist of multiple workbooks, which are designed to be a week or two of material, but vary in length depending on the nature of the material being covered. Each Workbook consists of multiple Lessons, a Pretest, Lab Test, and Exam.8
9Certifications Red Hat Certified System Administrator — RHCSA: (Ready to administer Red Hat Enterprise Linux environments)Certification program requirements:The Red Hat Certified System Administrator (RHCSA) exam consists of one section lasting up to 2.5 hours.The certification exam is performance-based, meaning that candidates must perform tasks on a live system, rather than answering questions about how one might perform those tasks.The hands-on nature of this exam make real-world experience a critical facet of preparation.RHCSA certifications have a current window for 3 calendar years after they are earned.Red Hat Certified Engineer — RHCE:(Be a senior system administrator of Red Hat Enterprise Linux systems)RHCE candidates must have earned their RHCSA certification to be eligible to become an RHCE.An RHCE exam consists of 1 section lasting up to 2 hours.The hands-on nature of this exam makes real-world experience a critical facet of preparation.RHCEs, who are certified on Red Hat Enterprise Linux 6, will have a current status for 3 calendar years after it is earnedFor additional information about Red Hat Enterprise Linux certifications please go to:
10Questions Feel free to ask questions Your Instructor will have three responses:“The answer is…”“We’ll be discussing that in a future unit”“I don’t know, but I will find out”It’s impossible to know everything, so feel free to share pertinent information as we go throughout the course since we can all learn from each other.
11LogisticsSecurity office – at the middle of the hall directly in front of the elevatorsRestrooms (down the hall make a right and its on the left corner of the next hallway)Snacks, drinks, places to eatCell phones turned off or set to silent modeComputer lab closed after class, but is available for daytimeuse if a class is not scheduled; procedure = call 1st to check
12Class Schedule Start class 9:00am Breaks(2x15min) 10:15am & 3:15pm Each Saturday, the class will follow this schedule:Start class 9:00amBreaks(2x15min) 10:15am & 3:15pmLunch :30pmResume class 1:30pmAdjourn 5:00pm
13About Your Course Instructor Augusto Delgado Background and experienceEducationCurrent positions
14About You and Your Fellow Participants Your nameCurrent position if presently employedBackgroundExpectations14
15Vulcan Linux Accounts introduction Practicing Outside of the RHA030 ClassVulcan Linux Accounts introductionThis is how you will be able to practice Linux commands from home or any internet connection15
16LET’S GET STARTED Workbook 1: Quick Tour Key ConceptsIn Linux, user sessions are started by "logging in" to the machine.To login, you must have already been provided a username and password.If a Linux machine is running an X server, users may login using the graphical interface.Users may login on any of six virtual consoles.The CTRL+ALT+F2 through CTRL+ALT+F6 key sequences switch between the six virtual consoles.The CTRL+ALT+F1 key sequence switches to the default X server.If a Linux machine supports it, users can login in over the network using a remote shell.The who command lists which users are currently logged in, and how they logged on.16
17Virtual ConsolesRed Hat Enterprise Linux provides six "virtual consoles" that are available to users physically at the computer. The virtual consoles act like "dumb terminals". The virtual consoles are accessed using the CTRL+ALT+F2 through CTRL+ALT+F6 key sequences, with one virtual console mapped to each of the first 6 function keys. (If you are in a graphical environment, you should know that CTRL+ALT+F1 will return you to it before trying to switch to a virtual console.)Virtual Consoles work only on the host not the VMs
18The X Graphical Environment When running on modern personal computers, Linux uses a low level program known as the "X server" to provide the graphics environment. As a user of the system, you don't interact with the X server directly, but it provides the canvas for all of the graphical programs that you run.When the X server starts, usually as part of the system's startup sequence, it looks for the "first available" virtual console. If you are on a virtual console, and think that an X server is running on the machine, you can usually switch to it using the CTRL+ALT+F1 key sequence.Using the Login Manager: (How to login and out of the graphical environment)
19Terminals in the Graphical environment In Red Hat Enterprise Linux, the most commonly used terminal application is called gnome-terminal. A new gnome-terminal window can be opened by right-clicking on the desktop background, and choosing the top menu item in the pop-up menu, "Open in Terminal". Alternately, you may select the Applications : System Tools : Terminal menu item.
20Using the who command to determine who's on the system. Users can use the who command to determine who is on the system, and how they logged on. From any terminal, users can type who and hit the RETURN key. They should see output similar to the following.The first column lists the users who have logged on, and the last few columns the time that they logged on. With a little experience, the second column tells where the user logged on. For the first two users, elvis, and root, tty2 and tty3 refers to virtual consoles number 2 and 3, respectively. The first entry for blondie on tty1 with the :0, refers to the X server itself running on the first virtual console, and pts/0 refers to the first terminal opened within the X server. Without getting too bogged down in the details, we can see that elvis is logged on the second virtual console, root on the third, and blondie has logged in using the graphical environment.
21Logging into a machine over the network Using the ssh ("secure shell") utility, users can easily log in to remote machines, either in the same room, or halfway across the world. Assuming the remote machine is configured to allow remote logins, and the user has an account on the machine, logging in to a remote machine can be as easy as logging in on a virtual console. In the following example, elvis will login to a virtual console on the local machine, called station.redhat.com. He will then use ssh to login to the remote machine nimbus.example.com, potentially halfway around the world.Pay careful attention to the shell prompt in the following example. Because Linux users are often "hopping" from machine to machine using remote shells, the prompt has been designed to help the user keep straight what machine the shell is running on.
22Online Exercises Using multiple virtual consoles: Press CRTL + ATL + F1 (Already shown a demo)Power on VM RHEL6-030Click on “student” accountPassword = redhatClick on “Login”Applications > System Tools > TerminalLets change the password for users elvis:su -Password: redhatpasswd elvisnew password = redhatexitSystem > Log Out studentClick on “elvis” account; password = redhatFinished
23Chapter 2. The Kernel, Programs, and Processes The Linux KernelThe Linux kernel is an operating system, just as Windows, MacOS, and OS/2 are operating systems. The operating system is an environment in which programs run, providing mechanisms for programs to interact with the computer hardware. The kernel lets programs know when a keyboard key was struck, when the mouse moved, or when a packet destined for the program arrived over the network. The kernel allows programs to access the harddrive, perhaps to read a configuration files or store data.Just as it would be difficult to explain what a language is to people who have grown up only knowing about one language, it is often difficult to explain what an operating system is to people who are new to computers, or who have only used one operating system. The operating system operates at such a low level, that users don't interact with it directly, and often don't realize that the programs they are running are using it.Figure 2.1. The Kernel and ProcessesThe Kernel and Processes
24ProgramsPrograms are files that are stored on a computer's harddrive. A program is a series of very basic instructions, that tell the operating system what to do and when to do it in a very detailed and specific manner. The following might be the instructions written down in the file /usr/bin/gcalctool
25ProcessesWhen a user instructs the kernel to run a program, the kernel reads the instructions found in the program file, and loads them into memory. It then begins performing the instructions. The copy of the program running in memory is called a process. Note that the same program can be loaded into memory and run more than once, so that at any point the kernel might be running several processes which are instances of the same program.Linux, like most modern operating systems, is a multitasking operating system. This means that the kernel gives the appearance of running multiple processes simultaneously. In reality, the kernel is running a single process for a brief amount of time, usually on the order of 50 milliseconds. It then swaps that process out, and swaps in another one for its 50 milliseconds of action. Eventually, the kernel works its way through all of the processes and starts over again. The rapid switching from process to process gives the users of the machine the impression that all of the processes are running simultaneously.
26ShellsLinux users often use a special type of program, called a shell, to interact with the kernel. The shell runs within a terminal, issuing a prompt and waiting to be told what to do. A user then asks the shell to run a program by typing in the name of the program. In the following example, the user elvis asks the shell to run a simple calendar program called cal. The shell dutifully executes the program, and reports the program's output back to the terminal:
27The ps commandThe ps command is commonly used to list processes running on a system. The ps command, without arguments, shows all of the processes that were started from a single terminal (or terminal window in a graphical environment). In the following example, elvis discovers that his terminal currently has two processes running: his bash shell, and the ps command itself.The first column shows the process's PID, or Process ID. Every process running on the system is identified by a unique PID. The second column identifies elvis's terminal, and the third column reports how much CPU time the process has consumed.The ps aux command shows a detailed list of all processes that are currently running on the system.
28Chapter 3. Examining the Filesystem Key ConceptsThe base of the Linux directory tree is a directory named / and referred to as "the root directory".Absolute file references, such as /home/elvis/lsout.txt, refer to files relative to the root directory.Relative file references, such as lsout.txt, refer to files relative to a process's current working directory.The ls command is used to list a directory's contentsThe cat command is used to examine the contents of a file.Using the > character from the shell's command line, the output of a command can be redirected from the terminal into a file.A user's home directory is one of the few places where users are able to create new files.
29The Naming of Files and Directories In Linux, information and programs are stored on disks as files. Files are grouped into directories, which can contain files and other directories. (Other operating systems often refer to directories as "folders"). This hierarchy of directories containing directories is often referred to as the "directory tree".The base of the directory tree is a directory named simply /, and referred to as "the root directory". Files within the root directory can be referred to as /filename.In summary, there are always two ways to refer to a file. File references relative to the root directory always start with a leading /, and are called absolute references. File references relative to the current working directory start with something other than a /, and are referred to as relative references.
30Listing directory contents with ls From a shell, users use the ls command to list the contents of a directory. (Think of the ls as a shortening of the verb "list".) In the following example, the user elvis wants to list the contents of the /etc/sysconfig/rhn directory.The ls command, when called without arguments (i.e., without specifying a directory), lists the contents of the shell's current working directory. If using a color terminal, the ls command also colorizes the filenames to help distinguish which of the directory contents are regular files (white), and which are directories (blue).The ls command is a very flexible command that can provide a lot of different information. It will be discussed in more detail in later lessons.
31Viewing the contents of a file with cat While the ls command lists the files contained in a given directory, it does not reveal the contents of the files. While several commands are available for viewing files, the simplest command is cat. The cat command, when given a list of files, concatenates the files to the terminal output. If given one filename, the contents of that single file is displayed as output.In the following example, the user elvis wants to view the contents of the /etc/hosts configuration file.Note that if you ask cat to display a very long file, or a binary (non text) file, cat will happily comply. There are more sophisticated commands for browsing large files, a screen full at a time, which will be introduced later.
32Redirecting command output to files When the previous ls and cat commands were performed, their output was displayed on the terminal. In Linux, most commands which generate text output use a common Unix concept called the "standard out" stream. By default, this stream is connected to the terminal. The bash shell allows users to "redirect" the standard out stream to other locations. For now, we will only learn the simplest case: using the > character to redirect standard out into a file.In the following example, the user elvis is again going to list the contents of the /etc/sysconfig/rhn directory, but redirect the output into a newly created file.The output of the ls /etc/sysconfig/rhn command was not displayed on the terminal, but instead placed into the newly created file lsout.txt. elvis next takes a ls of his current working directory, and sees the newly created file. He then uses the cat command to observe the contents of the file. In "Unix speak", elvis "redirected the output from the ls command to the file lsout.txt".
33Permissions, and a user's home directory. Notice what happens when elvis tries to redirect output to a file somewhere other than his shell's current working directory.The user elvis has encountered another common Unix concept, that of file ownerships and permissions. elvis tried to create the new file /etc/lsout.txt, but elvis does not have permissions to create files in the /etc directory.By default, in Red Hat Enterprise Linux, users are not able to create files just anywhere. In fact, there are only a few places where files can be created. Every user has a home directory, where they can create new files (and new subdirectories). Fortunately, when user's log in to a Linux session, their shell uses their home directory as its current working directory. By default in Red Hat Enterprise Linux, a user's home directory is named /home/username, where username is replaced with the user's username.
34Online Exercises Chapter 3. Examining the Filesystem The ls CommandLab ExerciseObjective: Redirect command output into a newly created file.Estimated Time: 5 mins.SpecificationUse the ls command to list the contents of the /etc directory, redirecting the output of the command into a file called lsetc.txt in your home directory.DeliverablesThe file lsetc.txt in your home directory, which contains the output of the command ls /etc.Possible SolutionThe following command provides a possible solution to this exercise.student]$ ls /etc > lsetc.txt
35Chapter 4. Running Commands Key ConceptsLike any language, the bash shell uses a specific grammar.The first word on any command-line is the name of the program to be run.The behavior of commands can be modified with (usually optional) command line switches, which always start with one or two hyphens (- or --).Any words that follow the command and any command line switches are called the arguments to the command.Some command line switches also take arguments.Commands usually support the --help, -h, or -? command line switch, which dumps a summary of how to use the command.
36Command Line GrammarIf commands entered on the command line were compared to English sentences, the commands could be thought of as having verbs, adverbs, and direct objects. The verb is the command to run, the adverbs are the various command line switches that can be used to modify the behavior of the command (“quietly”, or “verbosely”), and any remaining words are the direct objects (what the command is supposed to act on). Again, as in languages, there are irregularities, and for almost every rule mentioned, there will be exceptions.
37CommandsThe first word on any command is generally the name of a program that lives as a file somewhere in the filesystem.  For example, the previous lessons used the ps and who commands. If we want to know which file contains these programs, there is a program called which which can help us. The which command, followed by the name of another command, will tell you "which" file is being run.
38Command Line SwitchesMany commands can have their behavior modified by specifying different command line switches. An easy example is the ls command, which is used to list the contents of a directory. Consider the following three uses of the ls command, each time listing the files in the /usr directory:The first ls command simply lists the contents of the directory. The second ls -s command, which includes the -s command line switch, gives the sizes of the contents as well. The third ls -l command gives a "long" listing
39Short Command Line Switches Notice that both switches used above, -s and -l, are single letter switches. These are referred to as "short" command line switches. Sometimes, short command line switches can also take an argument. For example, the ls command has a -w command line switch, which specifies how "wide" the output should be, in characters. Consider the following example.In this case, the word 40 is not considered an argument to the ls command, but instead it is an argument to the -w command line switch. (How wide should the output be? 40 characters.) Command line switch arguments simply follow the command line switch. How do you know which command line switches take arguments and which don't? The short answer is through experience, but we will soon mention ways to find help as well.
40Multiple Short Command Line Switches More than one command line switch can be used at a time. The multiple command line switches are simply bunched together, squeezed between the command and any command arguments. The following example introduces a new -r switch for the ls command, which reverses the sorting order. Note how it is used along with the -s and -w switches.
41Multiple Short Command Line Switches Often, when using multiple command line switches, users will take advantage of a shortcut that lets all of the switches be "piled together" onto one hyphen (-), as in the following example.All of the single letter switches that don't take an argument, in this case -s and -r, can be piled together, sharing a single -. If a switch does take an argument, such as -w 40, it can only share a hyphen if it comes last. That way, its argument can be specified next on the command line.
42Long Command Line Switches In the early days of Unix, all command line switches shared the syntax above. As Unix evolved, people came to see a need for what are called "long" command line switches. Rather than single letter switches, long switches are composed of words. And rather than starting with a leading hyphen, long switches are proceeded by double hyphens (--). Some commands use only short switches, some commands use long. Many commands, including ls, handle some of both.
43ArgumentsCompared to command line switches, arguments are easy. Whatever words are left over on the command line, after the command name and after any command line switches, are called arguments to the command. What a command expects as arguments, or if it expects any at all, depend on the command. For example, the ls command, if given arguments, will treat the arguments as the files or directories to be listed. The ps command expects no arguments. The cal command takes from zero to two, a possible month and a possible year to generate the calendar for. Learning what arguments a program expects, and what it does with its arguments, is part of learning how to use that command.
44Getting Help: UsageHow does anyone remember all of these command line switches? They don't. But experienced Linux users learn how to easily refresh their memories. Most commands support either the --help long command line switch, or the -h or -? short command line switches. These switches usually make the command dump a "usage" message, rather than performing it's normal operation. The usage message contains a summary of what arguments are expected, what command line switches are supported and what they do. Note that the usage message generated by the ls command is rather long, and has been abbreviated in the output below.
45Chapter 5. Managing Terminals Key ConceptsVarious control sequences, such as CTRL+C, CTRL+D, and CTRL+Z, can be helpful for managing processes from the terminal.A terminal's settings can usually be reset to a sane behavior with the reset command.The bash shell provides tab completion, which can be save a lot of typing when specifying command or files.Various types of terminals can be distinguished by knowing how Linux refers to devices.
46Controlling Terminals The bash shell, and the terminal it runs on, are the primary tools used by experienced Linux users. Later in this course, an entire Workbook will be devoted to using the bash shell's powerful features. This lesson introduces some features shared by terminals in general, and one feature of the bash shell that is too useful to delay until later, tab completion.
47Resetting TerminalsWhen terminals display information, they usually display one byte at a time. When computers are handling human readable text, the characters are usually encoded as an integer byte value using the ASCII format. While a byte can encode up to 256 different values, only a small number of these (about 100) are used for text characters and punctuation. The others are used to encode control sequences (see below) and other special conditions.Sometimes, users accidentally (or intentionally) ask a terminal to display data that is not encoded as ASCII text, such as an image or an executable. The terminal does the best job it can, displaying characters for ASCII text, but what often appears to be random garbage for bytes that refer to control characters. Even worse, the terminal can end up in an alternate graphics mode, so that even what should be normal ASCII text looks unreadable.In these situations, the reset command can restore the terminal to sane behavior. Usually, when you'd like to use this command, you won't even be able to see yourself type it. However, if at an unreadable bash prompt, blindly typing reset and followed by the RETURN key will usually restore the terminal to sane behavior.
48Terminal control sequences Linux terminals share a lot in common with their primitive ancestors, teletypes and "dumb" or vt100-like consoles. These early devices had mechanisms for sending "out of band" signals, or sequences that signaled some event outside of the normal flow of typed characters, such as a backspace, a linefeed, an audible bell, or an end of transmission. Linux terminals, like their predecessors, use the CTRL key to send these "out of band" signals.
49Terminal control sequences The following table summarizes many of the commonly used control sequences that are shared by all Linux terminals, and their common usage, in alphabetical order. Following the table, the various control sequences are discussed in order of general usefulness.
50Terminal control sequences CTRL+C = MAKE IT STOP!CTRL+D = This control sequence is used to send an "End of Transmission" (usually interpreted as "End of File") to the listening processCTRL+Z is used to suspend a program, which can later be restored with the fg ("foreground") command.CTRL+U is commonly used to "wipe" the current line. If you have so mangled a bash command line that you just want to start over, type CTRL+U. Also, CTRL+U is very helpful when you mess up while entering a password.
51Terminal control sequences CTRL+H serves the exact same role as the BACKSPACE key.CTRL+L was traditionally used to tell a line printer to eject the current page and start on the next oneCTRL+Q "thaws" a screen (causing it to become active again) after it has been "frozen" with a CTRL+S. Although it is only useful after a CTRL+S has been used, it is introduced first (as the more useful command) because almost no one intentionally uses CTRL+S. Instead, new Unix users will sometimes accidentally type a CTRL+S, and not understand why their terminal has gone unresponsive. If your terminal ever seems dead, try typing a CTRL+Q and see if that fixes it.
52Identifying terminals Dating back from it's origins as a terminal server, Unix is obsessed with the concept of a terminal. Processes are grouped into "sessions" based on which terminal they were started from. While somewhat outdated, knowing how to recognize terminals can help in tracking the origins of processes.As with most other devices, programs interact with terminals at a low level through device nodes, found within the /dev directory. For example, communication with the first virtual console uses the device node /dev/tty1. Most processes keep a record of which terminal they were started from, and user's login sessions are usually associated with the terminal they are using. When identifying terminals in these situations, the terminal is referred to by its device node, for example, tty1.In the following excerpt, elvis is listing the current users on a machine with who, and listing the current processes running from his terminal with ps. In both cases, the terminal is specified in the column "TTY".
55Tab CompletionTab completion is not really a feature of terminals, but of the bash shell that is usually run within them. Tab completion could well be the most helpful topic within this lesson. When typing the names of commands and files, a lot of time and effort can be saved by learning how to make good use of the TAB key.When typing the name of a command as the first word of a bash command line, start typing the command you would like to run, but at some point before you finish the word, stop and hit the TAB key. One of three things will happen.The rest of the command you were beginning to type magically appears.Part of the command you were typing magically appears, but then bash stops and beeps at you.bash just beeps at you.
56Online Exercises Chapter 5. Managing Terminals Suspending terminal outputLab ExerciseObjective: Learn to manage terminal output for long running commands.Estimated Time: 5 mins.SpecificationLike prince in the example, take a recursive listing of the root directory of the filesystem, using the command ls -R /.While the output is flowing by, freeze your terminal using the CTRL+S control sequence.Thaw the terminal using the CTRL+Q control sequence. You should be able to alternately freeze and thaw the streaming output by using these control sequences.With the output from the command still flowing, suspend the process with the CTRL+Z control sequence.Confirm your lab with the process suspended.DeliverablesA stopped (suspended) ls -R / command.Cleaning UpAfter you have finished confirming your deliverable, restore the suspended process to the foreground with the fg command. Now cancel it with the CTRL+C control sequence.
57Chapter 6. Getting Help Key Concepts Most commands provide terse summaries when invoked with the -h, -?, or --help command line switch.More complete reference information can be found in the "man pages", which are viewed with the man command.The man pages have chapters, and the content of a preceding chapter might obscure the content of a trailing chapter.More complicated commands are often more fully described in info pages.In Red Hat Enterprise Linux, any less conventional documentation associated with a specific package can be found in /usr/share/doc.The Linux Documentation Project provides a wealth of Linux related documentation.Red Hat manuals provide documentation specific to the Red Hat Enterprise Linux distribution.
58Getting HelpUnix, and Linux in particular, has a tradition that manuals and documentation should not be kept on a bookshelf, but found within the system, in easy reach of the system's users. No one remembers every command line switch to the ls command, so most commands provide terse summaries called "usages" when invoked with the appropriate command line switches. More complete reference information for most commands can be found in structured "man" pages and "info" pages. In Red Hat Enterprise Linux, the /usr/share/doc directory contains less structured documentation specific to a particular package. Lastly, a wealth of guides and tutorials can be found at the Linux Documentation Project, or in Red Hat Enterprise Linux documentation packages.
59Obtaining Usages with -h, -?, and --help No one remembers all of the functionality of every command, but experienced Unix users know how to quickly find the information they are looking for online. The first layer of help is often provided by commands themselves, in the form of "usages", or short summaries of syntax that are produced when the command is invoked with the -h, -?, or --help command line switch. Usages were covered in a previous Lesson, but are mentioned here again for the sake of completeness.
60Man PagesManual pages, more often abbreviated "man pages", are the traditional source of reference information of Unix systems. A documentation page for most commands, file formats, programming calls, and general topics can be viewed using the man command. For example, man ls generates documentation for the ls command.The less PagerRed Hat Enterprise Linux uses the less pager for viewing man pages. When viewing files (including man pages) in less, navigation is provided by single letter keystrokes: space is used to view the next page, b is used to go back a page, q is used to quit. less will be covered in more detail in a later lesson, but the table below summarizes some of the most useful navigation commands when viewing man pages with less.
61Man ChaptersMan pages are organized into eight standard chapters, as itemized in the following tables. Some pages share identical names in different chapters. For example, pages exist for both the passwd command, found in chapter one on user commands, but also the /etc/passwd file, found in chapter five on file formats. Unfortunately for the user trying to find documentation on the /etc/passwd file format, man passwd only displays the first page it finds, in this case the entry from chapter one. In order to view the man page from chapter five, the chapter must be explicitly specified, as in man 5 passwd.
62Keyword Searches, and the -a Switch. Two switches commonly used with the man command include -k, for performing keyword searches, and -a, for viewing "all relevant" pages for an argument. The user madonna is trying to find information on the format for the /etc/passwd file. She has already discovered that man passwd only produces the man page for the passwd command, so she uses man -k to perform a keyword search on the word passwd.
63Info PagesMan pages are usually designed to provide reference information, not tutorials or help on general context. Many more complicated commands are more fully documented in hyperlinked "info" pages. Info pages predate the days of web browsers and clickable links. Info pages are viewed using either the traditional info command, or Red Hat Enterprise Linux provides a similar command with an easier interface called pinfo. Info pages are primarily used by software developed by the GNU project.The command pinfo, without arguments, will list a table of contents for all installed info pages. Basic navigation is similar to the less pager. Links among the info pages can be traversed using the four arrow keys, as outlined in the table below.
64The /usr/share/doc Directory One of the design principles behind open source software is often summarized "release early, release often". When developing software, distribute it as soon as it is useful, even if it is not yet polished or well documented. By allowing users to use software early, they can help influence the ongoing design of the software for the better.Red Hat Enterprise Linux embraces this philosophy, and will include useful, stable software, even if the software is not formally documented in man pages or info pages. Often, documentation about how to use newly developed products might be a simple text file called README hastily thrown together by the developer. Red Hat Enterprise Linux includes such unstructured, but often still helpful, documentation, within the /usr/share/doc directory, organized by the Red Hat package that owns the software.Your mileage will vary about how useful the documentation is for any given package. For example, elvis discovers that the informal documentation provided for the evince document viewer is rather skimpy, consisting primarily of the developers' unstructured ChangeLog and a terse README.
65More on Documentation Red Hat Documentation Guides The Linux Documentation Projectyelp: The Gnome Help Browser