1
00:00:00,090 --> 00:00:01,680
Sometimes, you're going to need

2
00:00:01,680 --> 00:00:04,500
further assistance with the syntax and the different options

3
00:00:04,500 --> 00:00:06,960
for a Linux command that you're using in the Shell.

4
00:00:06,960 --> 00:00:09,300
In this video, you're going to learn how to get the help

5
00:00:09,300 --> 00:00:11,190
you need from within the Shell itself,

6
00:00:11,190 --> 00:00:13,620
using something known as a man page.

7
00:00:13,620 --> 00:00:16,140
No matter what your experience, level or role is,

8
00:00:16,140 --> 00:00:18,300
documentation can help users of Linux

9
00:00:18,300 --> 00:00:20,130
perform a wide variety of activities,

10
00:00:20,130 --> 00:00:22,170
and resolve a wide range of issues.

11
00:00:22,170 --> 00:00:24,150
Because there is no official form of Linux

12
00:00:24,150 --> 00:00:26,670
or single authoritative source of documentation,

13
00:00:26,670 --> 00:00:28,380
you're going to find that documentation

14
00:00:28,380 --> 00:00:30,300
is spread across multiple sources,

15
00:00:30,300 --> 00:00:33,270
including manual pages, built-in help commands,

16
00:00:33,270 --> 00:00:36,570
online documentation projects, Usenet news groups,

17
00:00:36,570 --> 00:00:39,300
internet mailing lists, Q&A websites,

18
00:00:39,300 --> 00:00:41,550
forums and social media, as well as books

19
00:00:41,550 --> 00:00:43,410
and other print resources.

20
00:00:43,410 --> 00:00:45,480
Now, the first one and the most important one

21
00:00:45,480 --> 00:00:47,910
for you to look at is the man pages.

22
00:00:47,910 --> 00:00:50,910
The man pages are available on Linux systems by default,

23
00:00:50,910 --> 00:00:53,190
and they contain a complete documentation

24
00:00:53,190 --> 00:00:55,200
that's specific to each Linux command,

25
00:00:55,200 --> 00:00:57,510
and it's going to be displayed using the man command

26
00:00:57,510 --> 00:01:00,420
from within the command line interface or the Shell.

27
00:01:00,420 --> 00:01:01,650
They usually include information

28
00:01:01,650 --> 00:01:03,150
such as the name of the command,

29
00:01:03,150 --> 00:01:05,730
its syntax, a description of its purpose,

30
00:01:05,730 --> 00:01:08,430
the options it supports, examples of common usage

31
00:01:08,430 --> 00:01:11,190
of the command, and a list of related commands.

32
00:01:11,190 --> 00:01:13,680
Man pages are perhaps the most immediate source of help

33
00:01:13,680 --> 00:01:15,510
available to you, because they're right there

34
00:01:15,510 --> 00:01:17,430
at your fingertips whenever you need to learn more

35
00:01:17,430 --> 00:01:20,520
about a command and what it does or how it operates.

36
00:01:20,520 --> 00:01:23,160
But it can be difficult for somebody who's not familiar

37
00:01:23,160 --> 00:01:25,980
with the formatting of a man page to actually read them.

38
00:01:25,980 --> 00:01:27,660
So, let's talk a little bit

39
00:01:27,660 --> 00:01:30,090
about the different parts of a man page.

40
00:01:30,090 --> 00:01:32,370
Now, the first part is the synopsis.

41
00:01:32,370 --> 00:01:34,620
The synopsis is the part of the man page

42
00:01:34,620 --> 00:01:36,600
that provides the syntax of the command,

43
00:01:36,600 --> 00:01:38,760
along with some example use cases.

44
00:01:38,760 --> 00:01:41,760
For example, when you see bold text, this means something

45
00:01:41,760 --> 00:01:45,360
you would type in exactly as shown into the CLI.

46
00:01:45,360 --> 00:01:47,760
Italic text, on the other hand, should be replaced

47
00:01:47,760 --> 00:01:49,140
with the appropriate argument,

48
00:01:49,140 --> 00:01:51,780
and this may be formatted differently on certain systems,

49
00:01:51,780 --> 00:01:54,090
like an underlying text or a colored text,

50
00:01:54,090 --> 00:01:56,370
depending on your Linux distribution.

51
00:01:56,370 --> 00:02:00,060
Next, we have a part that looks like -abc,

52
00:02:00,060 --> 00:02:01,800
and this indicates that all the arguments

53
00:02:01,800 --> 00:02:04,650
within those brackets are going to be optional.

54
00:02:04,650 --> 00:02:07,320
If you see two arguments separated by a pipe,

55
00:02:07,320 --> 00:02:11,009
like -a|-b, this indicates that the arguments

56
00:02:11,009 --> 00:02:13,860
on the other side of the pipe cannot be used together.

57
00:02:13,860 --> 00:02:16,080
This is an "either or" argument pair

58
00:02:16,080 --> 00:02:17,640
that you have to pick between.

59
00:02:17,640 --> 00:02:21,210
If you see any italics text with an ellipsis, like "..."

60
00:02:21,210 --> 00:02:24,480
after it, this indicates that the argument can be repeated,

61
00:02:24,480 --> 00:02:26,970
and you can have multiple sets of arguments.

62
00:02:26,970 --> 00:02:29,610
The man command also supports different options,

63
00:02:29,610 --> 00:02:33,680
such as -a, -D, -f, -h, -k, -K, -t.

64
00:02:42,480 --> 00:02:45,240
If you type -a, you're going to find

65
00:02:45,240 --> 00:02:47,400
all the entries matching your query.

66
00:02:47,400 --> 00:02:50,430
If you type -D, you're going to be displaying

67
00:02:50,430 --> 00:02:52,200
the debugging information.

68
00:02:52,200 --> 00:02:54,990
If you type in -f this will display

69
00:02:54,990 --> 00:02:56,700
a short description of the command,

70
00:02:56,700 --> 00:02:58,590
along with the man pages.

71
00:02:58,590 --> 00:03:01,050
If you use the -h command,

72
00:03:01,050 --> 00:03:02,610
this is going to display help options

73
00:03:02,610 --> 00:03:04,560
for the man command itself.

74
00:03:04,560 --> 00:03:06,600
If you type -k,

75
00:03:06,600 --> 00:03:08,340
you're going to get a list of all the manuals

76
00:03:08,340 --> 00:03:10,920
and pages and sections that contain the keywords,

77
00:03:10,920 --> 00:03:12,720
along with their location.

78
00:03:12,720 --> 00:03:15,450
If you use the -K, you're going to search

79
00:03:15,450 --> 00:03:18,510
for the specified string on all of the pages.

80
00:03:18,510 --> 00:03:22,080
By typing a -t, the man pages will be formatted

81
00:03:22,080 --> 00:03:23,880
so they can be printed out.

82
00:03:23,880 --> 00:03:25,260
As you're probably already seeing,

83
00:03:25,260 --> 00:03:29,130
man pages can become really complicated, but really useful.

84
00:03:29,130 --> 00:03:30,990
When you look at man page sections,

85
00:03:30,990 --> 00:03:33,960
these are going to define what category the command belongs to.

86
00:03:33,960 --> 00:03:36,180
When a command has more than one section listed,

87
00:03:36,180 --> 00:03:38,460
it means the documentation for the same command

88
00:03:38,460 --> 00:03:40,830
is available for more than one source.

89
00:03:40,830 --> 00:03:42,120
These sections are identified

90
00:03:42,120 --> 00:03:44,490
by the number displayed beside the command.

91
00:03:44,490 --> 00:03:47,820
For example, the command fsck is used to check

92
00:03:47,820 --> 00:03:49,860
and repair the Linux file system.

93
00:03:49,860 --> 00:03:52,740
If you search for fsck in the man pages,

94
00:03:52,740 --> 00:03:56,610
you're going to see fsck(8) displayed.

95
00:03:56,610 --> 00:03:58,380
This indicates which of the eight sections

96
00:03:58,380 --> 00:03:59,940
or categories of man pages

97
00:03:59,940 --> 00:04:02,130
this particular command is assigned to.

98
00:04:02,130 --> 00:04:04,440
Section one contains general commands.

99
00:04:04,440 --> 00:04:06,720
Section two contains system calls.

100
00:04:06,720 --> 00:04:09,510
Section three contains C library functions.

101
00:04:09,510 --> 00:04:11,940
Section four contains special files.

102
00:04:11,940 --> 00:04:15,090
Section five contains file formats and conventions.

103
00:04:15,090 --> 00:04:18,000
Section six contains games and screen savers.

104
00:04:18,000 --> 00:04:20,399
Section seven contains miscellaneous.

105
00:04:20,399 --> 00:04:22,440
And lastly, section eight contains system

106
00:04:22,440 --> 00:04:24,660
administration commands and daemons.

107
00:04:24,660 --> 00:04:26,130
There's also going to be special keys

108
00:04:26,130 --> 00:04:27,180
that can be used to navigate

109
00:04:27,180 --> 00:04:29,550
the Linux man pages on your keyboard.

110
00:04:29,550 --> 00:04:30,990
If you use the Home key,

111
00:04:30,990 --> 00:04:33,450
this moves the cursor to beginning of the man page.

112
00:04:33,450 --> 00:04:34,800
And if you press the End key,

113
00:04:34,800 --> 00:04:37,410
it moves you all the way to the end of that man page.

114
00:04:37,410 --> 00:04:39,510
By pressing Page Up or Page Down,

115
00:04:39,510 --> 00:04:42,660
you'll scroll either up one or down one page at a time.

116
00:04:42,660 --> 00:04:44,460
If you press the forward slash key,

117
00:04:44,460 --> 00:04:47,610
this will begin a new search for a term or text string.

118
00:04:47,610 --> 00:04:49,530
If you press the End key, this will move

119
00:04:49,530 --> 00:04:51,780
to the next occurrence of that search term.

120
00:04:51,780 --> 00:04:53,340
And if you press P, it'll move you

121
00:04:53,340 --> 00:04:55,920
to the previous occurrence of that search term.

122
00:04:55,920 --> 00:04:58,170
Finally, when you're done reviewing the man page,

123
00:04:58,170 --> 00:04:59,970
you can press Q to quit,

124
00:04:59,970 --> 00:05:02,610
and then you'll be returned back to the Shell prompt.

125
00:05:02,610 --> 00:05:05,730
As I said, using man pages is really helpful.

126
00:05:05,730 --> 00:05:07,170
I do recommend that you play around

127
00:05:07,170 --> 00:05:09,810
with the man command a little bit on your Cent OS system,

128
00:05:09,810 --> 00:05:12,510
so you get more comfortable using it on a daily basis.

