1 00:00:06,639 --> 00:00:11,130 So when working with Linux, sometimes you may have a hard time finding which man page to use. 2 00:00:11,689 --> 00:00:12,810 Now what are you going to do? 3 00:00:13,689 --> 00:00:18,070 Well, you are going to use the fact that normally you have an index of man pages in the mandb. 4 00:00:19,350 --> 00:00:23,890 And this mandb is a database with a short description of all the man pages. 5 00:00:24,989 --> 00:00:30,710 You can use man K, which is the same as the apropos command to search the mandb on keywords. 6 00:00:31,530 --> 00:00:36,060 In case you are searching for something very obvious and MAND is giving 7 00:00:36,060 --> 00:00:40,590 you nothing appropriate, then you need to generate the mandb using sudo mandb. 8 00:00:42,049 --> 00:00:48,990 In case you are wondering why. Well, normally the mandb is a scheduled job and these scheduled jobs don't run all the time. 9 00:00:49,850 --> 00:00:53,450 They run typically once a day. And on a freshly installed system 10 00:00:53,450 --> 00:00:57,049 you may find that the MANDB has not yet been generated. 11 00:00:57,570 --> 00:00:58,549 Let's go check this out. 12 00:01:00,369 --> 00:01:04,709 Let me start by using Man k user and then what do 13 00:01:04,709 --> 00:01:09,049 we see? Oh my goodness, we see a lot of results. 14 00:01:09,890 --> 00:01:15,437 We see so many results that I need to filter down a little bit and I need 15 00:01:15,437 --> 00:01:20,984 to think about what do I really want to do. Well, let's assume that I'm looking for 16 00:01:20,984 --> 00:01:26,532 the command to create user. Then I want man k user. But I only want to see 17 00:01:26,532 --> 00:01:32,079 commands from section 8 because section 8 is where you would normally find administrator commands. 18 00:01:32,719 --> 00:01:36,180 Creating a user sounds like an administrator task, now doesn't it? 19 00:01:37,340 --> 00:01:42,469 In order to filter out only the results from Section 8, I'm going to send the 20 00:01:42,469 --> 00:01:47,599 output of the man k user command to be used as input for the grep command. 21 00:01:48,659 --> 00:01:54,060 Grep is an amazing command that allows you to filter output. And I'm going to grab for 22 00:01:54,060 --> 00:01:59,460 eight As a result, I will only see lines that have an 8 in the result. 23 00:02:00,459 --> 00:02:03,019 There we can see that the line is a little bit more readable. 24 00:02:03,920 --> 00:02:05,170 User ad from section 8. 25 00:02:06,239 --> 00:02:10,740 That is what we probably need to do next. Obviously you can use 26 00:02:10,740 --> 00:02:15,240 man on user ad to read all the information about user ad. 27 00:02:16,400 --> 00:02:21,449 Let me use Q because I want to show you one more thing that is Man 28 00:02:21,449 --> 00:02:26,500 K sender Sander is my first name and oh boy, I'm getting a nothing appropriate. 29 00:02:27,939 --> 00:02:31,319 Now this is the nothing appropriate that I want you to be aware of. 30 00:02:32,819 --> 00:02:38,319 What can you do if that is happening? Well, I would say let's check out the man page for man 31 00:02:38,319 --> 00:02:43,819 to figure out more about man minus K so that you can learn what maybe we had to do. 32 00:02:44,439 --> 00:02:49,430 And here we can see the synopsis and all different use cases for man K. You 33 00:02:49,430 --> 00:02:54,420 also see a list of all the different sections in Man, I haven't talked about all 34 00:02:54,419 --> 00:02:59,409 of them because for now section 1, 5 and 8 are the only ones that matter. 35 00:03:00,129 --> 00:03:06,019 And then Am I really going to scroll down? No, I'm not going to scroll down. I am 36 00:03:06,019 --> 00:03:11,909 going to search for the option K. So I'm using forward slash K and I'm pressing enter. 37 00:03:12,770 --> 00:03:17,215 And look at that man K print F searches for short 38 00:03:17,215 --> 00:03:21,659 descriptions. That's exactly what I need. And that's equivalent to apropos. 39 00:03:23,319 --> 00:03:29,069 That means that I can use Q2 get out and use man apropos to get the man page for apropos. 40 00:03:29,770 --> 00:03:36,094 There we can see that it is updated by the mandb command. Now if you need to know how 41 00:03:36,094 --> 00:03:42,419 to do it, then next man on mandb and there we can see mandb is coming from section eight. 42 00:03:43,419 --> 00:03:47,800 Now I don't really have to use it because my mandb is working perfectly. All right, 43 00:03:47,800 --> 00:03:52,180 but in case you do have to use it, type MANDB and see what happens. 44 00:03:54,099 --> 00:03:58,129 Oh boy, this is what happens. I'm getting permission denied all over. 45 00:03:58,750 --> 00:04:03,025 And you know why? That's because mandb is in section 8 46 00:04:03,025 --> 00:04:07,300 and commands in section 8 typically need super user privileges. 47 00:04:07,840 --> 00:04:09,560 So that will be sudo mandb. 48 00:04:10,689 --> 00:04:17,345 Then I need to enter my password and there we can see that MandB is generated. Again, nothing 49 00:04:17,345 --> 00:04:24,000 new added. That's totally obvious because we just started with this system and nothing has changed yet.