CS计算机代考程序代写 Excel database Module 06 Getting Help

Module 06 Getting Help

Exam Objective
2.2 Using the Command Line to Get Help
Objective Description
Running help commands and navigation of the various help systems

Introduction

Introduction
¡ñ Knowing how to find help while working in Linux is an essential skill for any user.
¡ñ Referring to help provides a quick reminder of how a command works.
¡ñ This is a good information resource when learning new commands.

Man Pages

Man Pages
¡ñ UNIX is the operating system that Linux was modeled after.
¡ñ The developers of UNIX created help documents called man pages (short for
manual page).
¡ñ Man pages provide a basic description of the purpose of the command, as well as details regarding available options.

Viewing Man Pages
¡ñ To view a man page for a command, use the man command: man command
¡ñ For example, the following displays the man page for the ls command: sysadmin@localhost:~$ man ls
¡ñ Navigate the document using the arrow keys:
¡ñ To exit viewing a man page, use the Q key.

Viewing Man Pages
LS(1) User Commands LS(1)
NAME
SYNOPSIS
ls [OPTION]… [FILE]…
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is speci- fied.
Mandatory arguments to long options are mandatory for short options too.
-a, –all
do not ignore entries starting with .
ls – list directory contents
The man command uses a pager to display documents. Usually, this pager is the less command, but on some distributions, it may be the more command. Both are very similar in how they perform.

Man Page Sections
¡ñ Man pages are broken into sections.
¡ñ Each section is designed to provide specific information about a command.
¡ñ The following describes some of the more common sections found in man pages:
¡ð NAME: Provides the name of the command and a very brief description.
¡ð SYNOPSIS: Provides examples of how the command is executed.
NAME
ls – list directory contents
SYNOPSIS
ls [OPTION]… [FILE]…

Man Page Sections
¡ð DESCRIPTION: Provides a more detailed description of the command.
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor –sort is speci- fied.
¡ð OPTIONS: Lists the options for the command as well as a description of how they are used
-a, –all
-A, –almost-all
do not ignore entries starting with .
do not list implied . and ..
–author
with -l, print the author of each file

Man Page Sections
¡ð FILES: Provides a more detailed description of the command.
¡ð AUTHOR: Provides the name of the person who created the man page and (sometimes) how to contact the person.
-a, –all
-A, –almost-all
do not ignore entries starting with .
do not list implied . and ..
–author
with -l, print the author of each file

Man Page Sections
¡ð REPORTING BUGS: Provides details on how to report problems with the command.
REPORTING BUGS
GNU coreutils online help: Report ls translation bugs to
¡ð COPYRIGHT: Lists the options for the command as well as a description of how they are used
COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Man Page Sections
¡ð SEE ALSO: Provides you with an idea of where you can find additional information. This often includes other commands that are related to this command.
SEE ALSO
Full documentation at: or available locally via: info ‘(coreutils) ls invocation’

Searching Man Pages
¡ñ To search a man page for a term, press the / and type the term followed by the Enter key. /all
¡ñ If the term is not found, or upon reaching the end of the matches, the program will report Pattern not found (press Return).
¡ñ If a match is found, to move to the next match of the term, press n. To return to a previous match of the term, press N.
Sort entries alphabetically if none of -cftuvSUX nor –sort is speci- fied.
Mandatory arguments to long options are mandatory for short options too.
-a, –all
do not ignore entries starting with .

Man Page Categorized by Sections
¡ñ There are thousands of man pages on a typical Linux distribution.
¡ñ To organize all of these man pages, they are categorized by sections.
¡ñ By default there are nine default sections of man pages:
¡ð General Commands
¡ð System Calls
¡ð Library Calls
¡ð Special Files
¡ð File Formats and Conventions
¡ð Games
¡ð Miscellaneous
¡ð System Administration Commands
¡ð Kernel Routines

Man Page Categorized by Sections
¡ñ The man command searches each of these sections in order until it finds the first match.
¡ñ For example, the cal command belongs to the first section of man pages:
¡ñ Sometimes there are man pages with the same name in different sections:
CAL(1) BSD General Commands Manual CAL(1)
sysadmin@localhost:~$ man -f passwd
passwd (5) passwd (1) passwd (1ssl)
– the password file
– change user password
– compute password hashes
¡ñ It may necessary to specify the section of the correct man page. To specify a different section, provide the number of the section as the first argument of the man command.
sysadmin@localhost:~$ man 5 passwd
PASSWD(5) File Formats and Conversions PASSWD(5)

Finding Commands and Documentation

Finding Commands and Documentation
¡ñ To search for the location of a command or the man pages for a command, use the whereis command.
¡ñ This command searches for commands, source files and man pages in specific locations where these files are typically stored:
sysadmin@localhost:~$ whereis ls
ls: /bin/ls /usr/share/man/man1p/ls.1.gz /usr/share/man/man1/ls.1.gz
¡ñ Man pages are easily distinguished from commands as they are typically compressed with a program called gzip, resulting in a filename that ends in .gz.

Find Any File or Directory
¡ñ To find any file or directory, use the locate command.
¡ñ This command searches a database of all files and directories that were on the system when the
database was created.
¡ð However, any files created that day will not be searchable with the locate command because the database is updated nightly.
¡ð It is possible to update the locate database manually by running the updatedb command as root.
¡ñ The output can be quite large so it may be helpful to use the following options:
¡ð The -c option to the locate command will list how many files match:
¡ð The -b option only includes listings that have the search term in the basename of the filename. To limit the output even further, place a \ character in front of the search term:
sysadmin@localhost:~$ locate -b “\passwd”
sysadmin@localhost:~$ locate -c passwd 97

Info Documentation

Viewing Info Documentation
¡ñ Man pages are excellent sources of information, but they do tend to have a few disadvantages:
¡ð Each man page is a separate document, not related to any other man page. ¡ð Man pages may can be difficult to read.
¡ñ The info command also provides documentation on operating system commands and features.
¡ð Info documentation as a logical organizational structure, making reading documentation easier .
¡ð Information is broken down into categories that work much like a table of contents in a book.
¡ñ Consider man pages to be more of a reference resource and info documents to be more of a learning guide.

Info Documentation
¡ñ To display the info documentation for a command, use the info command: sysadmin@localhost:~$ info ls
Next: dir invocation, Up: Directory listing
10.1 `ls’: List directory contents ==================================
The `ls’ program lists information about files (of any type, including directories). Options and file arguments can be intermixed arbitrarily, as usual.
Output Omitted…
¡ñ You can navigate the document using the arrow keys.
¡ñ This documentation is broken up into nodes. In the example below the line highlighted in white shows it¡¯s currently in the ls invocation node:
and control characters are output as-is.
–zz-Info: (coreutils.info.gz)ls invocation, 58 lines –Top————-
Welcome to Info version 5.2. Type h for help, m for menu item.

Navigating Info Documentation
¡ñ A listing of movement commands is available by hitting the Shift+H key while reading the info documentation.
Basic Info command keys
l Close this help window.
q Quit Info altogether.
h Invoke the Info tutorial.
Up Move up one line.
Down Move down one line.
PgUp Scroll backward one screenful. PgDn Scroll forward one screenful. Home Go to the beginning of this node. End Go to the end of this node.
Output Omitted…
¡ñ To quit the info documentation, use the Q key.

Additional Help

Using the Help Option
¡ñ Many commands will provide basic information, very similar to the SYNOPSIS found in man pages, by simply using the –help option to the command.
sysadmin@localhost:~$ ps –help
********* simple selection ********* ********* selection by list *********
-A all processes
-N negate selection
-a all w/ tty except session leaders
-d all except session leaders
-e all processes
T all processes on this terminal
a all w/ tty, including other users -t by tty
g OBSOLETE — DO NOT USE
r only running processes
x processes w/o controlling ttys
*********** output format **********
Output Omitted…
-u by effective user ID (supports names)
U processes for specified users
t by tty
*********** long options ***********
-C by command name
-G by real group ID (supports names)
-U by real user ID (supports names)
-g by session OR by effective group name -p by process ID
-s processes in the sessions given

Additional System Documentation
¡ñ ¡ñ ¡ñ
On most systems, there is a directory where additional documentation is found, such as documentation files stored by third-party software vendors.
These documentation files are often called readme files since the files typically have names such as README or readme.txt.
Typical locations for these files include /usr/share/doc and /usr/doc.