1 00:00:06,660 --> 00:00:09,240 In this lesson, I'd like to tell you about width and locate. 2 00:00:09,859 --> 00:00:15,509 Not the most important utilities, but very convenient. That's why I like to tell you about them. Anyway. 3 00:00:16,469 --> 00:00:22,399 So Find is very powerful and it's a thorough utility that helps you find any file no matter where it is stored. 4 00:00:23,039 --> 00:00:27,974 The disadvantage of Find is that on big file systems it might be slow, 5 00:00:27,974 --> 00:00:32,909 particularly if you have a composed file system that integrates many other devices. 6 00:00:33,710 --> 00:00:35,829 And that's why you might be interested in locate. 7 00:00:36,670 --> 00:00:42,869 Locate is much faster, but it works on a database that needs to be defined using the updatedb command. 8 00:00:43,770 --> 00:00:46,929 And also you need to update this database periodically. 9 00:00:47,630 --> 00:00:54,289 So if you are going to use locate and if you want to rely on it, probably you want 10 00:00:54,289 --> 00:01:00,949 to use updatedb as scheduled job using cron or systemd timers as explained later, which is also convenient. It 11 00:01:00,950 --> 00:01:07,609 is useful to find the exact location of binary files from the path variable. Let me show you. 12 00:01:09,090 --> 00:01:14,826 So let me type LS and let me use locate a file and 13 00:01:14,826 --> 00:01:20,563 then what do we get? We get oh boy, locate. No such file 14 00:01:20,563 --> 00:01:26,299 or directory. And that's because updatedb apparently has never happened on this system. 15 00:01:26,560 --> 00:01:29,000 So I need sudo updatedb to generate it. 16 00:01:29,640 --> 00:01:33,729 And now I'm using locate file and there you can see 17 00:01:33,729 --> 00:01:37,819 that it locates files that match the text pattern file. 18 00:01:38,760 --> 00:01:43,599 So do realize that locate is not going to need any wildcards and 19 00:01:43,599 --> 00:01:48,439 so on. It's just looking for files that contain the text pattern. 20 00:01:49,359 --> 00:01:51,560 Now, how about which. 21 00:01:53,390 --> 00:02:00,073 Which passwd, for instance, is printing the name of usr bin passwd that makes that 22 00:02:00,073 --> 00:02:06,756 you can use constructions like LS l and whichpass wd. Now what is that? When 23 00:02:06,756 --> 00:02:13,439 you put a command between a dollar and parenthesis, that's what we call command substitution. 24 00:02:14,000 --> 00:02:19,685 And the result is that the command will work on the result of the whichpass WD command. So you don't 25 00:02:19,685 --> 00:02:25,370 need to know where exactly this command is on your valve system, which will find it out automatically for you. 26 00:02:26,150 --> 00:02:29,310 As I told you, small utilities, but they can be convenient.