WEBVTT 00:00:00.000 --> 00:00:04.290 Hello. Today we're going to be talking about file organization for a small 00:00:04.290 --> 00:00:10.080 penetration test company. What is a pen test? A pen test is an attack on a 00:00:10.080 --> 00:00:15.240 computer or a network for the purposes of trying to find out what weaknesses 00:00:15.240 --> 00:00:20.789 the device(s) happen to have so that they can be taken care of before the bad guys 00:00:20.789 --> 00:00:27.000 try to attack. Pen tests are conducted with legal written permission by the of 00:00:27.000 --> 00:00:32.460 the owners of the attacked devices. So this company has just started conducting 00:00:32.460 --> 00:00:37.920 penetration tests. They've got five clients so far and they have started to 00:00:37.920 --> 00:00:42.239 create a number of different files for each of the different clients they have. 00:00:42.239 --> 00:00:47.219 For example, a nondisclosure agreement or NDA that pretty much says we won't let 00:00:47.219 --> 00:00:54.360 anybody else other than the owners of the devices know what we found out, so 00:00:54.360 --> 00:01:00.059 we're not going to tell anybody, "Hey, this company has these weaknesses." They have 00:01:00.059 --> 00:01:07.500 the letter with written permission to be able to conduct the tests; this one permission 00:01:07.500 --> 00:01:12.060 is sometimes called informally a "get-out-of-jail-free card." The pen 00:01:12.060 --> 00:01:15.030 testers have been taking notes as they've been conducting the tests and 00:01:15.030 --> 00:01:19.380 they've developed a final report and they have all this documentation on each 00:01:19.380 --> 00:01:26.100 of the different clients. Now at this point, I 00:01:26.100 --> 00:01:30.960 have all the relevant files in a directory that's inside my home 00:01:30.960 --> 00:01:36.090 directory. I'd like to copy all of that information into the directory we happen 00:01:36.090 --> 00:01:45.119 to be in at the moment. The command to copy things is "cp," and because we're 00:01:45.119 --> 00:01:51.509 going to be copying a directory, we're going to throw in the -r. Next, we 00:01:51.509 --> 00:01:55.649 have to say what it is we'd like to copy. We'd like to copy files that are in my 00:01:55.649 --> 00:02:02.280 home directory . The tilde ~ represents the home directory, and I'm going to start 00:02:02.280 --> 00:02:07.320 typing the name of the directory that we'd like to copy. It begins with an 00:02:07.320 --> 00:02:13.890 "f" - it's "files for video". As it happens I only have one particular item in 00:02:13.890 --> 00:02:17.010 my home directory that begins with the letter "f," so I'm going to hit the tab key 00:02:17.010 --> 00:02:23.580 now to autocomplete this relatively long name. I just happened to delete the slash 00:02:23.580 --> 00:02:27.990 that came at the end. When you hit "tab" and you have the name of a 00:02:27.990 --> 00:02:32.070 directory, the name will end with a slash / , so you can keep typing 00:02:32.070 --> 00:02:35.820 additional information. As it happens, I don't wish to type anything else, so I just 00:02:35.820 --> 00:02:40.590 deleted this /. It really doesn't matter whether you have that there or not. I'd like 00:02:40.590 --> 00:02:45.989 to copy that information into our current directory. cp always requires two 00:02:45.989 --> 00:02:51.360 arguments; basically, you're saying, "copy what where": What do I wish to copy? The 00:02:51.360 --> 00:02:57.030 directory "files for video". Where do I want to copy it? Here. A single dot . , as 00:02:57.030 --> 00:03:03.570 you'll recall, represents "Here. The current directory." and if I do an ls 00:03:03.570 --> 00:03:12.810 right now, I can see that I do, in fact, have a "files for video" directory. I'm now 00:03:12.810 --> 00:03:17.910 going to switch into my "files for video," directory, so I type "cd f" and I 00:03:17.910 --> 00:03:23.040 hit the tab. Now you'll notice that everything that begins with "f" in this 00:03:23.040 --> 00:03:28.890 directory goes on to have an "il" as the next two characters, so Linux was able to 00:03:28.890 --> 00:03:32.940 autocomplete the "il," but it doesn't know at this point: Do I want to 00:03:32.940 --> 00:03:38.190 keep typing "es" for "files"? Do I want to type the "lters" for "filters"? It doesn't know, so I'm going 00:03:38.190 --> 00:03:52.290 to give it an "e" and hit tab. It fills in the "s" for us. If I hit an "f" it'll in the rest of the "for." Hit "v," hit tab again and it fills in the rest of 00:03:52.290 --> 00:03:57.810 "video," so you can see that you can hit tab multiple times. So now my "files for 00:03:57.810 --> 00:04:05.700 video" is my active directory and I'm going to take a look inside it and I see 00:04:05.700 --> 00:04:11.549 that I've got a fair number of files here. Now if we are only ever going to be 00:04:11.549 --> 00:04:15.769 having five clients then everything could stay in one directory, 00:04:15.769 --> 00:04:21.750 but we're starting to realize that -- wait a minute -- we're going to have a whole lot 00:04:21.750 --> 00:04:24.930 more clients coming up, and this directory that we have is just going to be 00:04:24.930 --> 00:04:29.400 getting larger and larger and larger, and it's going to become less and less 00:04:29.400 --> 00:04:34.860 easy to be able to find the files that we would like, so we better come up with 00:04:34.860 --> 00:04:38.820 some sort of an organization so that we'll be able to find the files that we 00:04:38.820 --> 00:04:43.259 wish quickly and easily. There are a couple of different approaches we could 00:04:43.259 --> 00:04:47.940 take with these particular files. One approach -- and the one we're going to be 00:04:47.940 --> 00:04:56.130 using -- looks like this. I've ignored all the directory structure that's not 00:04:56.130 --> 00:05:02.610 relevant to us at the moment. We are in the CIS one forty-one directory. We're 00:05:02.610 --> 00:05:05.729 going to create a directory for all of our pen test information. I'm just 00:05:05.729 --> 00:05:10.620 calling it "PT" for "pen test," and then we're going to have a separate directory for 00:05:10.620 --> 00:05:15.960 each of our different clients. Within each of the client directories, we'll 00:05:15.960 --> 00:05:18.389 have the relevant information -- our get-out-of-jail-free card, our 00:05:18.389 --> 00:05:27.210 non-disclosure agreement, the running notes, and the final pen test report. We 00:05:27.210 --> 00:05:30.960 could have organized things in a different way; instead of organizing by client, we 00:05:30.960 --> 00:05:34.110 could have organized by type of information. So we could have put all of 00:05:34.110 --> 00:05:39.300 our get-out-of-jail free cards in one directory all of our NDAs in another 00:05:39.300 --> 00:05:45.060 directory, and so forth. On both this and the past slide, some details are omitted 00:05:45.060 --> 00:05:51.539 just so that the slides wouldn't get too cluttered. So the client information for 00:05:51.539 --> 00:05:59.780 the notes and the reports directories were omitted here. Up here, 00:05:59.780 --> 00:06:04.110 the information for the specific files underneath client3 and for client5 00:06:04.110 --> 00:06:10.949 have been omitted, but you can extrapolate what they would be. So okay, 00:06:10.949 --> 00:06:16.370 we're going to have to create some directories. We'll start off by creating 00:06:16.370 --> 00:06:22.919 the PT directory for our pen tests. The command to create a directory is mkdir. 00:06:22.919 --> 00:06:28.199 It's pronounced "make dir," but it's spelled mkdir. OK, so we've created our 00:06:28.199 --> 00:06:32.490 pen test directory. You can see I've just executed another ls, and we can see our 00:06:32.490 --> 00:06:37.440 pen test directory PT. Inside this directory, we're going to be creating a 00:06:37.440 --> 00:06:40.639 directory called "client1," 00:06:41.340 --> 00:06:51.270 so mkdirPT /client1 Now when we go to move our files, we can 00:06:51.270 --> 00:06:54.960 shorten their names as well. We no longer have to have "PT" and "client1" as part 00:06:54.960 --> 00:06:59.220 of the name of each of these files because we can get the information that 00:06:59.220 --> 00:07:02.790 it's about a pen test and it's for client one just from our directory 00:07:02.790 --> 00:07:10.050 structure. So the syntax of the command to move files is very similar to the 00:07:10.050 --> 00:07:14.930 syntax of the command for copying. The command for moving is "mv" and it's 00:07:14.930 --> 00:07:27.840 "move what where": What are we going to be moving? We're going to be moving our PT client one's get-out-of-jail-free card. Where are we going to be moving it? We're 00:07:27.840 --> 00:07:32.220 going to be moving it into the PT directory -- inside there into the client1 00:07:32.220 --> 00:07:44.070 sub directory -- and from there we're going to call the file simply GooJFC for 00:07:44.070 --> 00:07:50.729 "get-out-of-jail-free card." We can execute an ls command, and we can see that we no 00:07:50.729 --> 00:07:55.979 longer have the get out of jail free card for client one in our current 00:07:55.979 --> 00:08:04.620 directory. If we do an ls for our PT/client1 directory, you can see that in 00:08:04.620 --> 00:08:13.500 fact we do have the file with the shortened name inside the directory. Now 00:08:13.500 --> 00:08:17.910 we're going to do the same thing for each of our other three client1 files. 00:08:17.910 --> 00:08:28.639 I'm going to use the up arrow to retrieve my most recent mv command and 00:08:28.639 --> 00:08:34.950 I'm using the left arrow and the backspace to move to where I need to be 00:08:34.950 --> 00:08:41.880 and to delete the letters I don't want in here. This is just a quicker way of 00:08:41.880 --> 00:08:49.010 coming up with the command rather than having to type it all again by hand. Up arrow 00:08:50.899 --> 00:09:05.779 notes and report. I'm going to clear the screen screen quickly with the ctrl^L 00:09:05.779 --> 00:09:11.610 keyboard shortcut, and ls shows us that we no longer have client1 00:09:11.610 --> 00:09:20.490 files in the current directory, but if we do a ls of PT/client1, we can see that 00:09:20.490 --> 00:09:26.450 we have all of the files that we had before in our client1 directory. Now 00:09:26.450 --> 00:09:33.390 okay, we're going to go ahead and create a client2 directory mkdir PT/client2 00:09:33.390 --> 00:09:43.290 and we could copy all of the files here individually into that 00:09:43.290 --> 00:09:55.430 directory; so we could, for example, say mv PTclient2GooJFC Pt/client2/GooJFC 00:09:55.430 --> 00:10:39.400 00:10:39.580 --> 00:10:49.450 and we could 00:10:49.450 --> 00:10:54.820 do that similar sort of thing for all of the remaining files. There is, however, a 00:10:54.820 --> 00:11:00.640 faster way to accomplish our task. We could we'd once again start out saying 00:11:00.640 --> 00:11:07.720 mv PTclient2 but now instead of listing an end of each individual 00:11:07.720 --> 00:11:14.500 file we can use an asterisk; the asterisk says, "substitute here any zero 00:11:14.500 --> 00:11:21.400 or more characters," so just in this one phrase PTclient2* 00:11:21.400 --> 00:11:26.770 it's as if here we typed all of the files whose names begin with 00:11:26.770 --> 00:11:36.100 PTclient2 Where do we want to put them? we want to put them in PT/client2 00:11:36.100 --> 00:11:43.810 to let's verify that we did what we wanted to do. ls. We don't see anything 00:11:43.810 --> 00:11:47.977 about client2 in our current directory. ls PT/client2 We have all four of out 00:11:51.610 --> 00:11:58.570 client2-related files within our client2 directory. Now, the downside of 00:11:58.570 --> 00:12:06.520 this is that we would need to rename the NDA, the notes, and the report file if we 00:12:06.520 --> 00:12:11.950 so desired to shorten up the names. In the interests of not boring you I'm not 00:12:11.950 --> 00:12:17.200 going to go through and shorten all those right now. In real life we might 00:12:17.200 --> 00:12:22.990 or might not choose to do so. At this point, I'm going to very quickly create 00:12:22.990 --> 00:12:30.340 client three, four, and five directories and put the relevant files into them. So 00:12:30.340 --> 00:12:37.100 mkdir PT/client3 PT/client4 PT/client5 00:12:37.220 --> 00:12:45.379 You can use the "mkdir" command with 00:12:45.379 --> 00:12:53.420 multiple different arguments, so that's just created the client3, client4, and 00:12:53.420 --> 00:13:03.769 client5 directories within our PT directory. I'm now going to move all the 00:13:03.769 --> 00:13:17.810 relevant files for client3 into the client3 directory, client 4 into the client4 directory, and client 5 into the client5 directory. directory if I do a quick LS I can see I 00:13:17.810 --> 00:13:25.600 I don't have any ordinary files inside my current directory; I could do an 00:13:25.600 --> 00:13:34.910 ls PT/client3 PT/client4 PT/client5 if I so desired, but ls actually has a nice 00:13:34.910 --> 00:13:45.589 option of -R The capital R says< "show me a recursive listing." What this 00:13:45.589 --> 00:13:51.470 means is this is saying not only show me what's immediately inside the PT 00:13:51.470 --> 00:13:56.480 directory, but if there are any directories in the PT directory, show me 00:13:56.480 --> 00:14:01.009 their contents and if there are any directories within their contents, show 00:14:01.009 --> 00:14:06.769 its contents all the way down the directory structure. So now we can see 00:14:06.769 --> 00:14:12.439 all at once that the PT directory contains the client1 through client5 00:14:12.439 --> 00:14:18.709 directories and we can see the contents of each of the individual client 00:14:18.709 --> 00:14:26.809 directories. I'll say as an aside that there are ways that you would be able to 00:14:26.809 --> 00:14:32.209 shorten the names to remove the PT client in a fashion that's more 00:14:32.209 --> 00:14:37.009 efficient than just doing it by hand. How you would do that, though, is 00:14:37.009 --> 00:14:41.300 beyond the scope of this discussion. OK, I just cleared the screen again and I'm 00:14:41.300 --> 00:14:48.319 going to cd into the PT directory and make a new directory for a hypothetical 00:14:48.319 --> 00:14:55.190 client six. and I'm going to cd into the client6 directory. One 00:14:55.190 --> 00:14:59.810 command that is very useful if you would just like to create an empty file -- in 00:14:59.810 --> 00:15:02.720 fact it's the command that I use to create all the files we've worked with 00:15:02.720 --> 00:15:10.550 today -- that's the "touch" command. So I could say touch NDA 00:15:10.550 --> 00:15:20.920 and I've created an empty 0 bytes file called NDA. 00:15:23.290 --> 00:15:28.310 I'm going to be switching topics a little bit so that I can talk about a couple of 00:15:28.310 --> 00:15:32.540 other things that I did wish to talk about in this video. So this is not 00:15:32.540 --> 00:15:38.480 directly pentest related, but suppose for some reason you wish to have the 00:15:38.480 --> 00:15:45.440 calendar -- the output of the cal command -- display not on your screen, but put it 00:15:45.440 --> 00:15:53.060 into a file. You can redirect the output of the "cal" command. This is saying, "Don't 00:15:53.060 --> 00:15:56.839 show me the calendar -- the output of the cal command -- on the screen. Instead, put 00:15:56.839 --> 00:16:01.220 it into a file that we're going to call 'calendar'." We now have a calendar file, and 00:16:01.220 --> 00:16:06.080 if we use the "cat" command to display the contents of the calendar file, we can see 00:16:06.080 --> 00:16:11.650 that it is in fact the calendar for the month in which I'm recording this video. 00:16:11.650 --> 00:16:17.300 Maybe we'll have another file that's going to show the output of the "date" 00:16:17.300 --> 00:16:24.260 command and we'll just call that file "day," and a cat of day reveals that it 00:16:24.260 --> 00:16:28.670 does in fact give us the output of the date command. Why am I creating these 00:16:28.670 --> 00:16:38.089 files? It's because I'd like to show you something about the mv command that 00:16:38.089 --> 00:16:43.640 also applies to the cp command and is very important. We've seen a couple of 00:16:43.640 --> 00:16:49.760 ways in which the mv or the cp commands can be used. With "copy what where," if "where" 00:16:49.760 --> 00:16:56.210 is the name of a file that does not exist, cp or mv will create a file by 00:16:56.210 --> 00:17:06.990 that name with the contents of the original file. So if i say cp x y then both of them will have 00:17:06.990 --> 00:17:16.109 identical content. If the "where" is the name of a directory, what we saw 00:17:16.109 --> 00:17:19.140 mv command holds true with the cp 00:17:19.140 --> 00:17:23.970 command, that the "copy what where," if the "where" is s directory it will take the 00:17:23.970 --> 00:17:29.490 "what" file specified and it will create a file within 00:17:29.490 --> 00:17:35.610 the specified directory with the contents of that file, so if I said cp x y 00:17:35.610 --> 00:17:40.680 with "y" being the name of a directory, what will result is there's going to be 00:17:40.680 --> 00:17:49.530 a file called y/ x with the x in the x directory containing the same content as 00:17:49.530 --> 00:17:54.870 the original file named x. There's a third possibility, though. The first 00:17:54.870 --> 00:18:01.410 possibility was the "what" was the name of a file that did not yet exist. The second 00:18:01.410 --> 00:18:08.280 possibility was the name of a directory. The third possibility 00:18:08.280 --> 00:18:17.010 is the name of a file that does exist. Suppose we decided to 00:18:17.010 --> 00:18:22.830 take information from "cal" and "date" and put it into a single file. I'm just going 00:18:22.830 --> 00:18:32.000 to call "when". So we can move the contents of our "day" file into a file called "when". 00:18:32.000 --> 00:18:43.050 We no longer have a file called "day." The file called "when" now has the output of 00:18:43.050 --> 00:18:49.530 the date command.Now watch very carefully: this is what I wanted to show you. 00:18:49.530 --> 00:18:56.970 If I type mv calendar when -- "when" is a file that already exists; it 00:18:56.970 --> 00:19:02.370 contains the output of the date command -- this is what's currently in the "when" file. 00:19:02.370 --> 00:19:11.280 I did not get any error messages. mv was perfectly happy to move the contents of 00:19:11.280 --> 00:19:18.520 calendar into the "when" file. An ls command shows again we no longer have 00:19:18.520 --> 00:19:27.970 a "calendar" file, but look at the contents of the "when" file. You see what happened 00:19:27.970 --> 00:19:32.410 in the calendar file, but the information from the output of the "date" file -- what had 00:19:32.410 --> 00:19:37.960 been in the "when" file before we copied the calendar contents into "when" -- that is 00:19:37.960 --> 00:19:46.060 gone, and this is the important caveat: If you're using mv or you're using cp 00:19:46.060 --> 00:19:52.030 and the second argument is the name of a file that exists, that file's original 00:19:52.030 --> 00:19:59.530 contents will be replaced with the contents of whatever was in the first 00:19:59.530 --> 00:20:09.760 argument, so be very careful with cp and mv. OK, so we've created quite a number of 00:20:09.760 --> 00:20:13.690 different files here and I'd like to clean up all the files that we worked 00:20:13.690 --> 00:20:17.410 with today. They're just ones that were created for this video; there's really no 00:20:17.410 --> 00:20:22.510 pen test company. I'm going to clean up the files, so the first thing I'd like to 00:20:22.510 --> 00:20:26.260 do would be to delete the directory that I'm in right now and all of its contents. 00:20:26.260 --> 00:20:33.580 To delete a directory use the "rmdir" command. I'm going to 00:20:33.580 --> 00:20:40.630 try to delete the directory I'm in right now and this period is usually used to 00:20:40.630 --> 00:20:48.210 mean "here". We saw it in an action earlier when we said cp -r cis141 . 00:20:48.210 --> 00:20:56.500 We're saying copy that 00:20:56.500 --> 00:21:03.640 one directory here. Dot (.) is a perfectly valid argument for many commands, but 00:21:03.640 --> 00:21:09.400 it's not valid for the "rmdir" command, and there's a reason for it which you could 00:21:09.400 --> 00:21:13.600 probably figure out on your own if you stopped to think for a moment. If we deleted 00:21:13.600 --> 00:21:19.120 the directory we were in, where would we be? We just got rid of the directory we 00:21:19.120 --> 00:21:24.670 were currently in and we have to be in some directory so rmdir basically 00:21:24.670 --> 00:21:28.300 says you can't delete the directory you're in, so I'm going to go up one 00:21:28.300 --> 00:21:33.809 level and I'm going to try deleting my client6 00:21:33.809 --> 00:21:40.650 directory and rmdir still is not going to be very happy. It's saying the 00:21:40.650 --> 00:21:47.720 directory is not empty; you've got files in it, so we can delete all those files. 00:21:47.720 --> 00:21:59.130 we could type in rm -- the command to delete a file -- client6/NDA and we 00:21:59.130 --> 00:22:09.240 could type in rm client6/when, and now we can try again rmdir client6 00:22:09.240 --> 00:22:15.350 Because we deleted everything inside client6, client6 was an empty directory. 00:22:15.350 --> 00:22:28.080 Because client6 is now an empty directory, 00:22:28.080 --> 00:22:35.010 rmdir we'll go ahead and delete it without any complaints. 00:22:35.010 --> 00:22:40.860 An ls shows us we no longer have a client6 directory. Suppose we wish to delete 00:22:40.860 --> 00:22:44.970 client5's directory and the first thing we wanted to do was to delete 00:22:44.970 --> 00:22:50.100 everything that's inside the client5 directory. Stop and think a minute to see 00:22:50.100 --> 00:22:54.150 if you can figure out how you could delete everything in there all in one 00:22:54.150 --> 00:23:02.190 line. Just a reminder: the contents of the client5 directory. Well, one thing we 00:23:02.190 --> 00:23:15.200 could do would be to type in rm client5/ this-filename client5/this-filename client5/this-filename 00:23:15.260 --> 00:23:23.730 That would be a lot of typing. Another thing we could do will be to type in 00:23:23.730 --> 00:23:33.960 rm client5/* That removes everything that's inside client5. Now in 00:23:33.960 --> 00:23:38.150 this particular case, that's exactly what we wanted to have happen, but be very 00:23:38.150 --> 00:23:43.110 careful with that asterisk, especially when you're using it in 00:23:43.110 --> 00:23:48.720 with a command such as "rm." If we had had a file in the client5 directory 00:23:48.720 --> 00:23:57.179 that we did, in fact, wish to preserve, it's too late. It's gone, and there is no trash 00:23:57.179 --> 00:24:02.880 bin or recycle bin or anything along those lines from which to be able to 00:24:02.880 --> 00:24:10.620 retrieve the data. It's not there anymore. One thing that we could do -- I'm 00:24:10.620 --> 00:24:18.660 going to go ahead and rmdir client5. With a client4 we could say rm -i client4/* 00:24:18.660 --> 00:24:26.610 What client that -s is saying is 00:24:26.610 --> 00:24:32.190 "Be interactive about your deletions -- ask me, for each individual 00:24:32.190 --> 00:24:37.620 file, "'Do you really wish to remove this?'" I do wish to remove all of them, but 00:24:37.620 --> 00:24:41.700 you can see that this provides a little bit of a safety net to make sure that 00:24:41.700 --> 00:24:47.130 we're really not deleting anything we don't wish to 00:24:47.130 --> 00:24:54.240 have deleted. So now I'm going to go ahead and delete client4, and if we 00:24:54.240 --> 00:24:58.060 wanted, we could do the same things with clients3, client2 and client1, but there's an easier way of doing 00:24:58.060 --> 00:25:11.340 things if you know for a fact that you wish to remove not only the directory, but everything underneath the directory. 00:25:11.340 --> 00:25:16.230 Any ordinary files or directory files inside it any directory files that are 00:25:16.230 --> 00:25:20.340 in directory files, that are inside it all the way down -- you know for a fact you 00:25:20.340 --> 00:25:26.130 wish to get rid of everything. Instead of removing them the rmdir command, 00:25:26.130 --> 00:25:36.210 you can use rm -r. rm -r, as you can see, works even 00:25:36.210 --> 00:25:42.750 if the directory contains data, and it's nice to be able to have both methods of 00:25:42.750 --> 00:25:47.610 being able to delete directories. If you know for 100% certain 00:25:47.610 --> 00:25:51.990 that you do wish to delete not only directory but everything 00:25:51.990 --> 00:25:56.850 underneath it, you can do so with rm -r, but that is very powerful. 00:25:56.850 --> 00:25:59.970 If you have any hesitation whatsoever, if you want to make sure that you're just 00:25:59.970 --> 00:26:06.750 removing empty directories, rmdir is the command for you. I'm going to go up a directory and say rm -r PT 00:26:11.738 --> 00:26:21.660 you'll note that at this point the PT directory contains two subdirectories which in turn contain a 00:26:21.660 --> 00:26:29.790 bunch of different files. all of which are now gone. So what we have seen so far 00:26:29.790 --> 00:26:36.510 today is how you can copy and move the files. You can create an empty file 00:26:36.510 --> 00:26:42.630 with the touch command. We've seen that rmdir will 00:26:42.630 --> 00:26:49.950 remove an empty directory. rm -r will remove a directory that may or may not 00:26:49.950 --> 00:26:55.230 be empty. If you wish to have an interactive way of working with rm, you 00:26:55.230 --> 00:27:01.470 could use -i. We've seen that an asterisk can substitute for 00:27:01.470 --> 00:27:10.320 any zero or more characters, and again the asterisk is extremely powerful but 00:27:10.320 --> 00:27:13.560 you have to be careful with it. The asterisk is an example of what is sometimes called 00:27:13.560 --> 00:27:18.630 a "globbing character." Another globbing character is a question mark, and that 00:27:18.630 --> 00:27:24.270 says, "Substitute exactly one character." Instead of "Substituting here zero 00:27:24.270 --> 00:27:30.390 or more," substitute exactly one. So we've also talked a little bit as an 00:27:30.390 --> 00:27:34.890 aside about what pen testing is and some of the documentation -- not all but some of 00:27:34.890 --> 00:27:38.550 the documentation -- that is involved in pen testing. That was just an added bonus. 00:27:38.550 --> 00:27:45.120 If you have any questions, please do feel free to ask your teacher and do be 00:27:45.120 --> 00:27:49.320 prepared -- if you are one of the Delaware Technical Community College CIS 141 00:27:49.320 --> 00:27:55.470 students for whom this video was created -- do be prepared to come 00:27:55.470 --> 00:28:02.900 into the classroom and to be able to conduct various organizations of 00:28:02.900 --> 00:28:09.360 groups of files. So we've seen one example here. Are there any other 00:28:09.360 --> 00:28:14.909 principles for organizing files? There actually are 00:28:14.909 --> 00:28:20.700 a variety of different tips I'd like to talk about, some of which we've already 00:28:20.700 --> 00:28:26.190 made mention of; others of which we have not. One is when you're organizing files, 00:28:26.190 --> 00:28:32.340 it's a good idea to keep data files separate from application files. One 00:28:32.340 --> 00:28:36.029 reason for this is that data files are going to be backed up much more 00:28:36.029 --> 00:28:40.139 frequently than application files, and by keeping them separate, it makes it easier 00:28:40.139 --> 00:28:43.160 to execute a backup strategy. 00:28:43.160 --> 00:28:53.059 You also want to have consistency in naming conventions for files and for folders or directories. We don't want to have client1 00:28:53.059 --> 00:28:58.470 for one directory and PTclient2 for another and thirdclient for a third. If 00:28:58.470 --> 00:28:58.970 we're using client followed by number, we want to keep that throughout. 00:28:58.970 --> 00:29:07.259 You want your names to be short but descriptive. You don't want to have great big lengthy 00:29:07.259 --> 00:29:11.970 things that, as you saw in our example, can be kind of hard to read and take a while to 00:29:11.970 --> 00:29:18.029 type, so make them fairly short. Use common abbreviations (I used PT for 00:29:18.029 --> 00:29:24.629 "pen test") and if a folder/directory -- I put in "folder" here because these tips 00:29:24.629 --> 00:29:29.940 are not Linux specific, they apply equally to Windows or to any other 00:29:29.940 --> 00:29:35.429 operating system -- but if you do see your container object (whatever it's called) 00:29:35.429 --> 00:29:39.750 start to have too much information and it starts to become unwieldy, create 00:29:39.750 --> 00:29:46.080 subfolders and sub-directories. A few possible ways you can organize things 00:29:46.080 --> 00:29:51.120 are completed versus incomplete, so if you've got different files for different 00:29:51.120 --> 00:29:54.870 projects, when you've finished a particular file -- you've done the work 00:29:54.870 --> 00:29:57.899 that is involved with that file -- you can move it from the "incomplete" to the 00:29:57.899 --> 00:30:03.509 "completed" directory. You might organize things by file type, so you'll have all of 00:30:03.509 --> 00:30:06.899 your workbooks together, all your documents in a separate directory, all of 00:30:06.899 --> 00:30:13.200 your slideshows in a third. You might wish to organize things by project -- that 00:30:13.200 --> 00:30:16.710 is, in essence, what we did here -- where we had client1, client2, client3, and 00:30:16.710 --> 00:30:24.000 each client involved a separate pen test. If you're dealing with Windows, 00:30:24.000 --> 00:30:27.810 put your documents in the document folder, create subfolders within the "Document" folder. 00:30:27.810 --> 00:30:34.320 You can use jump lists. I'm going to be panning down on my screen so that 00:30:34.320 --> 00:30:41.370 you can see my taskbar so I can demonstrate a jump list. If I right-click 00:30:41.370 --> 00:30:50.310 on one of the icons in the taskbar, what shows up is a jump list. These are my 00:30:50.310 --> 00:30:55.170 pinned items, these are ones that are going to be staying on my list even if I 00:30:55.170 --> 00:31:03.810 haven't happened to use them in a while. these are files that I've recently used. As I 00:31:03.810 --> 00:31:09.270 added new files, open up new files, the older ones will drop from the list. If 00:31:09.270 --> 00:31:14.340 I'd like to make sure that something stays on this list, I can pin it by 00:31:14.340 --> 00:31:19.620 clicking on the pushpin. I can unpin a pinned item by clicking on the push pin 00:31:19.620 --> 00:31:27.510 again. You might wish use the recent items on the start menu, but if for security 00:31:27.510 --> 00:31:30.990 reasons you don't wish to have a "recent items" on the start menu or you don't 00:31:30.990 --> 00:31:35.750 wish to have a jump list, there are ways of getting rid of those as well. 00:31:35.750 --> 00:31:42.360 If you have certain files that you open very, very, very frequently, you might wish 00:31:42.360 --> 00:31:46.650 to create a desktop shortcut in Windows to the particular item. That way, 00:31:46.650 --> 00:31:52.680 you can go to it directly without having to navigate the folder structure. If you 00:31:52.680 --> 00:31:58.710 are trying to find particular files, you can go into "computer" and for our 00:31:58.710 --> 00:32:02.220 discussion right now. I'd actually like to talk a little bit about how things 00:32:02.220 --> 00:32:09.960 are set up at Del Tech. We have a u: drive that teachers can add information to or 00:32:09.960 --> 00:32:14.130 make changes to. Students can look at and can copy files from it, but they're not 00:32:14.130 --> 00:32:18.510 allowed to make changes. I think the u: drive is an excellent example of 00:32:18.510 --> 00:32:23.610 organization. Even if you've never looked at the u: drive before, if you know that 00:32:23.610 --> 00:32:28.020 this video is for our CIS 141 class, you'd be able to just glance at 00:32:28.020 --> 00:32:31.620 the names of these folders. They're very short but they're descriptive. You should 00:32:31.620 --> 00:32:36.420 be able to figure out that this is the folder that you would be interested in. If you 00:32:36.420 --> 00:32:40.400 happen to know that my last name is "Mancini," you'd be 00:32:40.400 --> 00:32:45.530 able to look at these and you'd be able to zero in on exactly which folder would 00:32:45.530 --> 00:32:52.970 have information that is relevant, and then from here again you can go into the 00:32:52.970 --> 00:32:58.820 relevant folder. At this point, I'd like to look at the folder that just says 00:32:58.820 --> 00:33:03.050 "Windows." This contains a number of miscellaneous files for the purposes 00:33:03.050 --> 00:33:10.190 of practicing organization. Again, this is a relatively small number of 00:33:10.190 --> 00:33:14.150 files in this folder, but pretend that there were quite a number and we wish to 00:33:14.150 --> 00:33:20.120 find a particular one. I happen to be in the "Details" view right now. You can 00:33:20.120 --> 00:33:25.010 change your view by going to the View menu. You're going to "Details." If you 00:33:25.010 --> 00:33:29.660 don't happen to see your view menu, you could go to the drop-down list for 00:33:29.660 --> 00:33:37.340 "Organize," and choose "Layout," and you'll be able to see your menu bar, then you can 00:33:37.340 --> 00:33:42.200 bring up the View menu. We're currently in the details view now. The 00:33:42.200 --> 00:33:46.670 nice thing about the details view -- or one of the nice things beyond the fact that 00:33:46.670 --> 00:33:50.120 it gives you a lot more information about all the different files -- is that 00:33:50.120 --> 00:33:54.140 you can organize things quickly. If you knew that the file you were interested 00:33:54.140 --> 00:33:59.150 in was one that had been modified fairly recently, you can click on "Date Modified," 00:33:59.150 --> 00:34:04.970 and if you click on it once, it organizes things from the most recently to the 00:34:04.970 --> 00:34:08.659 least recently modified files. These files haven't been modified in quite a 00:34:08.659 --> 00:34:14.690 while. If you click on it again, it reverses the organization. If you knew 00:34:14.690 --> 00:34:18.500 that you wished to get rid of some files -- maybe you're running out of space -- and 00:34:18.500 --> 00:34:21.649 you wanted to see if are there a couple of really large files that you wish to get 00:34:21.649 --> 00:34:29.210 rid of, you could sort by size. The default order is sorting by name, and if 00:34:29.210 --> 00:34:33.859 you happen to have a mixture of both files and folders, the folders by default 00:34:33.859 --> 00:34:39.800 will show up first a through , then the ordinary files a through z. So, again, I 00:34:39.800 --> 00:34:44.179 hope you found these tips useful. Keep them in mind. Again, if you happen to be a 00:34:44.179 --> 00:34:49.040 CIS 141 student at Delaware Technical Community College, be sure to 00:34:49.040 --> 00:35:01.490 practice the commands that we discussed earlier in this video: cp, mv, touch, the ls with the -R option, rmdir, rm -r, the 00:35:01.490 --> 00:35:08.830 -i option, rm without any options. Practice the globbing 00:35:08.830 --> 00:35:17.240 character, the asterisk. Be prepared to come into class and be able to do 00:35:17.240 --> 00:35:21.980 something similar to what was done in this particular presentation.You will be 00:35:21.980 --> 00:35:27.920 given a directory that has a lot of files, and that you are going to have to try 00:35:27.920 --> 00:35:33.230 to come up with an appropriate organization for. Again, I hope you found 00:35:33.230 --> 00:35:37.730 this video interesting and useful and informative. If you have any questions, 00:35:37.730 --> 00:35:41.170 please do speak with your instructor