1 00:00:00,000 --> 00:00:04,290 Hello. Today we're going to be talking about file organization for a small 2 00:00:04,290 --> 00:00:10,080 penetration test company. What is a pen test? A pen test is an attack on a 3 00:00:10,080 --> 00:00:15,240 computer or a network for the purposes of trying to find out what weaknesses 4 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 5 00:00:20,789 --> 00:00:27,000 try to attack. Pen tests are conducted with legal written permission by the of 6 00:00:27,000 --> 00:00:32,460 the owners of the attacked devices. So this company has just started conducting 7 00:00:32,460 --> 00:00:37,920 penetration tests. They've got five clients so far and they have started to 8 00:00:37,920 --> 00:00:42,239 create a number of different files for each of the different clients they have. 9 00:00:42,239 --> 00:00:47,219 For example, a nondisclosure agreement or NDA that pretty much says we won't let 10 00:00:47,219 --> 00:00:54,360 anybody else other than the owners of the devices know what we found out, so 11 00:00:54,360 --> 00:01:00,059 we're not going to tell anybody, "Hey, this company has these weaknesses." They have 12 00:01:00,059 --> 00:01:07,500 the letter with written permission to be able to conduct the tests; this one permission 13 00:01:07,500 --> 00:01:12,060 is sometimes called informally a "get-out-of-jail-free card." The pen 14 00:01:12,060 --> 00:01:15,030 testers have been taking notes as they've been conducting the tests and 15 00:01:15,030 --> 00:01:19,380 they've developed a final report and they have all this documentation on each 16 00:01:19,380 --> 00:01:26,100 of the different clients. Now at this point, I 17 00:01:26,100 --> 00:01:30,960 have all the relevant files in a directory that's inside my home 18 00:01:30,960 --> 00:01:36,090 directory. I'd like to copy all of that information into the directory we happen 19 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 20 00:01:45,119 --> 00:01:51,509 going to be copying a directory, we're going to throw in the -r. Next, we 21 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 22 00:01:55,649 --> 00:02:02,280 home directory . The tilde ~ represents the home directory, and I'm going to start 23 00:02:02,280 --> 00:02:07,320 typing the name of the directory that we'd like to copy. It begins with an 24 00:02:07,320 --> 00:02:13,890 "f" - it's "files for video". As it happens I only have one particular item in 25 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 26 00:02:17,010 --> 00:02:23,580 now to autocomplete this relatively long name. I just happened to delete the slash 27 00:02:23,580 --> 00:02:27,990 that came at the end. When you hit "tab" and you have the name of a 28 00:02:27,990 --> 00:02:32,070 directory, the name will end with a slash / , so you can keep typing 29 00:02:32,070 --> 00:02:35,820 additional information. As it happens, I don't wish to type anything else, so I just 30 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 31 00:02:40,590 --> 00:02:45,989 to copy that information into our current directory. cp always requires two 32 00:02:45,989 --> 00:02:51,360 arguments; basically, you're saying, "copy what where": What do I wish to copy? The 33 00:02:51,360 --> 00:02:57,030 directory "files for video". Where do I want to copy it? Here. A single dot . , as 34 00:02:57,030 --> 00:03:03,570 you'll recall, represents "Here. The current directory." and if I do an ls 35 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 36 00:03:12,810 --> 00:03:17,910 going to switch into my "files for video," directory, so I type "cd f" and I 37 00:03:17,910 --> 00:03:23,040 hit the tab. Now you'll notice that everything that begins with "f" in this 38 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 39 00:03:28,890 --> 00:03:32,940 autocomplete the "il," but it doesn't know at this point: Do I want to 40 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 41 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 42 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 43 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 44 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 45 00:04:11,549 --> 00:04:15,769 having five clients then everything could stay in one directory, 46 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 47 00:04:21,750 --> 00:04:24,930 more clients coming up, and this directory that we have is just going to be 48 00:04:24,930 --> 00:04:29,400 getting larger and larger and larger, and it's going to become less and less 49 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 50 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 51 00:04:38,820 --> 00:04:43,259 wish quickly and easily. There are a couple of different approaches we could 52 00:04:43,259 --> 00:04:47,940 take with these particular files. One approach -- and the one we're going to be 53 00:04:47,940 --> 00:04:56,130 using -- looks like this. I've ignored all the directory structure that's not 54 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 55 00:05:02,610 --> 00:05:05,729 going to create a directory for all of our pen test information. I'm just 56 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 57 00:05:10,620 --> 00:05:15,960 each of our different clients. Within each of the client directories, we'll 58 00:05:15,960 --> 00:05:18,389 have the relevant information -- our get-out-of-jail-free card, our 59 00:05:18,389 --> 00:05:27,210 non-disclosure agreement, the running notes, and the final pen test report. We 60 00:05:27,210 --> 00:05:30,960 could have organized things in a different way; instead of organizing by client, we 61 00:05:30,960 --> 00:05:34,110 could have organized by type of information. So we could have put all of 62 00:05:34,110 --> 00:05:39,300 our get-out-of-jail free cards in one directory all of our NDAs in another 63 00:05:39,300 --> 00:05:45,060 directory, and so forth. On both this and the past slide, some details are omitted 64 00:05:45,060 --> 00:05:51,539 just so that the slides wouldn't get too cluttered. So the client information for 65 00:05:51,539 --> 00:05:59,780 the notes and the reports directories were omitted here. Up here, 66 00:05:59,780 --> 00:06:04,110 the information for the specific files underneath client3 and for client5 67 00:06:04,110 --> 00:06:10,949 have been omitted, but you can extrapolate what they would be. So okay, 68 00:06:10,949 --> 00:06:16,370 we're going to have to create some directories. We'll start off by creating 69 00:06:16,370 --> 00:06:22,919 the PT directory for our pen tests. The command to create a directory is mkdir. 70 00:06:22,919 --> 00:06:28,199 It's pronounced "make dir," but it's spelled mkdir. OK, so we've created our 71 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 72 00:06:32,490 --> 00:06:37,440 pen test directory PT. Inside this directory, we're going to be creating a 73 00:06:37,440 --> 00:06:40,639 directory called "client1," 74 00:06:41,340 --> 00:06:51,270 so mkdirPT /client1 Now when we go to move our files, we can 75 00:06:51,270 --> 00:06:54,960 shorten their names as well. We no longer have to have "PT" and "client1" as part 76 00:06:54,960 --> 00:06:59,220 of the name of each of these files because we can get the information that 77 00:06:59,220 --> 00:07:02,790 it's about a pen test and it's for client one just from our directory 78 00:07:02,790 --> 00:07:10,050 structure. So the syntax of the command to move files is very similar to the 79 00:07:10,050 --> 00:07:14,930 syntax of the command for copying. The command for moving is "mv" and it's 80 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 81 00:07:27,840 --> 00:07:32,220 going to be moving it into the PT directory -- inside there into the client1 82 00:07:32,220 --> 00:07:44,070 sub directory -- and from there we're going to call the file simply GooJFC for 83 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 84 00:07:50,729 --> 00:07:55,979 longer have the get out of jail free card for client one in our current 85 00:07:55,979 --> 00:08:04,620 directory. If we do an ls for our PT/client1 directory, you can see that in 86 00:08:04,620 --> 00:08:13,500 fact we do have the file with the shortened name inside the directory. Now 87 00:08:13,500 --> 00:08:17,910 we're going to do the same thing for each of our other three client1 files. 88 00:08:17,910 --> 00:08:28,639 I'm going to use the up arrow to retrieve my most recent mv command and 89 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 90 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 91 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 92 00:08:50,899 --> 00:09:05,779 notes and report. I'm going to clear the screen screen quickly with the ctrl^L 93 00:09:05,779 --> 00:09:11,610 keyboard shortcut, and ls shows us that we no longer have client1 94 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 95 00:09:20,490 --> 00:09:26,450 we have all of the files that we had before in our client1 directory. Now 96 00:09:26,450 --> 00:09:33,390 okay, we're going to go ahead and create a client2 directory mkdir PT/client2 97 00:09:33,390 --> 00:09:43,290 and we could copy all of the files here individually into that 98 00:09:43,290 --> 00:09:55,430 directory; so we could, for example, say mv PTclient2GooJFC Pt/client2/GooJFC 99 00:09:55,430 --> 00:10:39,400 100 00:10:39,580 --> 00:10:49,450 and we could 101 00:10:49,450 --> 00:10:54,820 do that similar sort of thing for all of the remaining files. There is, however, a 102 00:10:54,820 --> 00:11:00,640 faster way to accomplish our task. We could we'd once again start out saying 103 00:11:00,640 --> 00:11:07,720 mv PTclient2 but now instead of listing an end of each individual 104 00:11:07,720 --> 00:11:14,500 file we can use an asterisk; the asterisk says, "substitute here any zero 105 00:11:14,500 --> 00:11:21,400 or more characters," so just in this one phrase PTclient2* 106 00:11:21,400 --> 00:11:26,770 it's as if here we typed all of the files whose names begin with 107 00:11:26,770 --> 00:11:36,100 PTclient2 Where do we want to put them? we want to put them in PT/client2 108 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 109 00:11:43,810 --> 00:11:47,977 about client2 in our current directory. ls PT/client2 We have all four of out 110 00:11:51,610 --> 00:11:58,570 client2-related files within our client2 directory. Now, the downside of 111 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 112 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 113 00:12:11,950 --> 00:12:17,200 going to go through and shorten all those right now. In real life we might 114 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 115 00:12:22,990 --> 00:12:30,340 client three, four, and five directories and put the relevant files into them. So 116 00:12:30,340 --> 00:12:37,100 mkdir PT/client3 PT/client4 PT/client5 117 00:12:37,220 --> 00:12:45,379 You can use the "mkdir" command with 118 00:12:45,379 --> 00:12:53,420 multiple different arguments, so that's just created the client3, client4, and 119 00:12:53,420 --> 00:13:03,769 client5 directories within our PT directory. I'm now going to move all the 120 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 121 00:13:17,810 --> 00:13:25,600 I don't have any ordinary files inside my current directory; I could do an 122 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 123 00:13:34,910 --> 00:13:45,589 option of -R The capital R says< "show me a recursive listing." What this 124 00:13:45,589 --> 00:13:51,470 means is this is saying not only show me what's immediately inside the PT 125 00:13:51,470 --> 00:13:56,480 directory, but if there are any directories in the PT directory, show me 126 00:13:56,480 --> 00:14:01,009 their contents and if there are any directories within their contents, show 127 00:14:01,009 --> 00:14:06,769 its contents all the way down the directory structure. So now we can see 128 00:14:06,769 --> 00:14:12,439 all at once that the PT directory contains the client1 through client5 129 00:14:12,439 --> 00:14:18,709 directories and we can see the contents of each of the individual client 130 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 131 00:14:26,809 --> 00:14:32,209 shorten the names to remove the PT client in a fashion that's more 132 00:14:32,209 --> 00:14:37,009 efficient than just doing it by hand. How you would do that, though, is 133 00:14:37,009 --> 00:14:41,300 beyond the scope of this discussion. OK, I just cleared the screen again and I'm 134 00:14:41,300 --> 00:14:48,319 going to cd into the PT directory and make a new directory for a hypothetical 135 00:14:48,319 --> 00:14:55,190 client six. and I'm going to cd into the client6 directory. One 136 00:14:55,190 --> 00:14:59,810 command that is very useful if you would just like to create an empty file -- in 137 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 138 00:15:02,720 --> 00:15:10,550 today -- that's the "touch" command. So I could say touch NDA 139 00:15:10,550 --> 00:15:20,920 and I've created an empty 0 bytes file called NDA. 140 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 141 00:15:28,310 --> 00:15:32,540 other things that I did wish to talk about in this video. So this is not 142 00:15:32,540 --> 00:15:38,480 directly pentest related, but suppose for some reason you wish to have the 143 00:15:38,480 --> 00:15:45,440 calendar -- the output of the cal command -- display not on your screen, but put it 144 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 145 00:15:53,060 --> 00:15:56,839 show me the calendar -- the output of the cal command -- on the screen. Instead, put 146 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 147 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 148 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. 149 00:16:11,650 --> 00:16:17,300 Maybe we'll have another file that's going to show the output of the "date" 150 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 151 00:16:24,260 --> 00:16:28,670 does in fact give us the output of the date command. Why am I creating these 152 00:16:28,670 --> 00:16:38,089 files? It's because I'd like to show you something about the mv command that 153 00:16:38,089 --> 00:16:43,640 also applies to the cp command and is very important. We've seen a couple of 154 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" 155 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 156 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 157 00:17:06,990 --> 00:17:16,109 identical content. If the "where" is the name of a directory, what we saw 158 00:17:16,109 --> 00:17:19,140 mv command holds true with the cp 159 00:17:19,140 --> 00:17:23,970 command, that the "copy what where," if the "where" is s directory it will take the 160 00:17:23,970 --> 00:17:29,490 "what" file specified and it will create a file within 161 00:17:29,490 --> 00:17:35,610 the specified directory with the contents of that file, so if I said cp x y 162 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 163 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 164 00:17:49,530 --> 00:17:54,870 the original file named x. There's a third possibility, though. The first 165 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 166 00:18:01,410 --> 00:18:08,280 possibility was the name of a directory. The third possibility 167 00:18:08,280 --> 00:18:17,010 is the name of a file that does exist. Suppose we decided to 168 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 169 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". 170 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 171 00:18:43,050 --> 00:18:49,530 the date command.Now watch very carefully: this is what I wanted to show you. 172 00:18:49,530 --> 00:18:56,970 If I type mv calendar when -- "when" is a file that already exists; it 173 00:18:56,970 --> 00:19:02,370 contains the output of the date command -- this is what's currently in the "when" file. 174 00:19:02,370 --> 00:19:11,280 I did not get any error messages. mv was perfectly happy to move the contents of 175 00:19:11,280 --> 00:19:18,520 calendar into the "when" file. An ls command shows again we no longer have 176 00:19:18,520 --> 00:19:27,970 a "calendar" file, but look at the contents of the "when" file. You see what happened 177 00:19:27,970 --> 00:19:32,410 in the calendar file, but the information from the output of the "date" file -- what had 178 00:19:32,410 --> 00:19:37,960 been in the "when" file before we copied the calendar contents into "when" -- that is 179 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 180 00:19:46,060 --> 00:19:52,030 and the second argument is the name of a file that exists, that file's original 181 00:19:52,030 --> 00:19:59,530 contents will be replaced with the contents of whatever was in the first 182 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 183 00:20:09,760 --> 00:20:13,690 different files here and I'd like to clean up all the files that we worked 184 00:20:13,690 --> 00:20:17,410 with today. They're just ones that were created for this video; there's really no 185 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 186 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. 187 00:20:26,260 --> 00:20:33,580 To delete a directory use the "rmdir" command. I'm going to 188 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 189 00:20:40,630 --> 00:20:48,210 mean "here". We saw it in an action earlier when we said cp -r cis141 . 190 00:20:48,210 --> 00:20:56,500 We're saying copy that 191 00:20:56,500 --> 00:21:03,640 one directory here. Dot (.) is a perfectly valid argument for many commands, but 192 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 193 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 194 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 195 00:21:19,120 --> 00:21:24,670 were currently in and we have to be in some directory so rmdir basically 196 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 197 00:21:28,300 --> 00:21:33,809 level and I'm going to try deleting my client6 198 00:21:33,809 --> 00:21:40,650 directory and rmdir still is not going to be very happy. It's saying the 199 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. 200 00:21:47,720 --> 00:21:59,130 we could type in rm -- the command to delete a file -- client6/NDA and we 201 00:21:59,130 --> 00:22:09,240 could type in rm client6/when, and now we can try again rmdir client6 202 00:22:09,240 --> 00:22:15,350 Because we deleted everything inside client6, client6 was an empty directory. 203 00:22:15,350 --> 00:22:28,080 Because client6 is now an empty directory, 204 00:22:28,080 --> 00:22:35,010 rmdir we'll go ahead and delete it without any complaints. 205 00:22:35,010 --> 00:22:40,860 An ls shows us we no longer have a client6 directory. Suppose we wish to delete 206 00:22:40,860 --> 00:22:44,970 client5's directory and the first thing we wanted to do was to delete 207 00:22:44,970 --> 00:22:50,100 everything that's inside the client5 directory. Stop and think a minute to see 208 00:22:50,100 --> 00:22:54,150 if you can figure out how you could delete everything in there all in one 209 00:22:54,150 --> 00:23:02,190 line. Just a reminder: the contents of the client5 directory. Well, one thing we 210 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 211 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 212 00:23:23,730 --> 00:23:33,960 rm client5/* That removes everything that's inside client5. Now in 213 00:23:33,960 --> 00:23:38,150 this particular case, that's exactly what we wanted to have happen, but be very 214 00:23:38,150 --> 00:23:43,110 careful with that asterisk, especially when you're using it in 215 00:23:43,110 --> 00:23:48,720 with a command such as "rm." If we had had a file in the client5 directory 216 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 217 00:23:57,179 --> 00:24:02,880 bin or recycle bin or anything along those lines from which to be able to 218 00:24:02,880 --> 00:24:10,620 retrieve the data. It's not there anymore. One thing that we could do -- I'm 219 00:24:10,620 --> 00:24:18,660 going to go ahead and rmdir client5. With a client4 we could say rm -i client4/* 220 00:24:18,660 --> 00:24:26,610 What client that -s is saying is 221 00:24:26,610 --> 00:24:32,190 "Be interactive about your deletions -- ask me, for each individual 222 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 223 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 224 00:24:41,700 --> 00:24:47,130 we're really not deleting anything we don't wish to 225 00:24:47,130 --> 00:24:54,240 have deleted. So now I'm going to go ahead and delete client4, and if we 226 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 227 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. 228 00:25:11,340 --> 00:25:16,230 Any ordinary files or directory files inside it any directory files that are 229 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 230 00:25:20,340 --> 00:25:26,130 wish to get rid of everything. Instead of removing them the rmdir command, 231 00:25:26,130 --> 00:25:36,210 you can use rm -r. rm -r, as you can see, works even 232 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 233 00:25:42,750 --> 00:25:47,610 being able to delete directories. If you know for 100% certain 234 00:25:47,610 --> 00:25:51,990 that you do wish to delete not only directory but everything 235 00:25:51,990 --> 00:25:56,850 underneath it, you can do so with rm -r, but that is very powerful. 236 00:25:56,850 --> 00:25:59,970 If you have any hesitation whatsoever, if you want to make sure that you're just 237 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 238 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 239 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 240 00:26:29,790 --> 00:26:36,510 today is how you can copy and move the files. You can create an empty file 241 00:26:36,510 --> 00:26:42,630 with the touch command. We've seen that rmdir will 242 00:26:42,630 --> 00:26:49,950 remove an empty directory. rm -r will remove a directory that may or may not 243 00:26:49,950 --> 00:26:55,230 be empty. If you wish to have an interactive way of working with rm, you 244 00:26:55,230 --> 00:27:01,470 could use -i. We've seen that an asterisk can substitute for 245 00:27:01,470 --> 00:27:10,320 any zero or more characters, and again the asterisk is extremely powerful but 246 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 247 00:27:13,560 --> 00:27:18,630 a "globbing character." Another globbing character is a question mark, and that 248 00:27:18,630 --> 00:27:24,270 says, "Substitute exactly one character." Instead of "Substituting here zero 249 00:27:24,270 --> 00:27:30,390 or more," substitute exactly one. So we've also talked a little bit as an 250 00:27:30,390 --> 00:27:34,890 aside about what pen testing is and some of the documentation -- not all but some of 251 00:27:34,890 --> 00:27:38,550 the documentation -- that is involved in pen testing. That was just an added bonus. 252 00:27:38,550 --> 00:27:45,120 If you have any questions, please do feel free to ask your teacher and do be 253 00:27:45,120 --> 00:27:49,320 prepared -- if you are one of the Delaware Technical Community College CIS 141 254 00:27:49,320 --> 00:27:55,470 students for whom this video was created -- do be prepared to come 255 00:27:55,470 --> 00:28:02,900 into the classroom and to be able to conduct various organizations of 256 00:28:02,900 --> 00:28:09,360 groups of files. So we've seen one example here. Are there any other 257 00:28:09,360 --> 00:28:14,909 principles for organizing files? There actually are 258 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 259 00:28:20,700 --> 00:28:26,190 made mention of; others of which we have not. One is when you're organizing files, 260 00:28:26,190 --> 00:28:32,340 it's a good idea to keep data files separate from application files. One 261 00:28:32,340 --> 00:28:36,029 reason for this is that data files are going to be backed up much more 262 00:28:36,029 --> 00:28:40,139 frequently than application files, and by keeping them separate, it makes it easier 263 00:28:40,139 --> 00:28:43,160 to execute a backup strategy. 264 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 265 00:28:53,059 --> 00:28:58,470 for one directory and PTclient2 for another and thirdclient for a third. If 266 00:28:58,470 --> 00:28:58,970 we're using client followed by number, we want to keep that throughout. 267 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 268 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 269 00:29:11,970 --> 00:29:18,029 type, so make them fairly short. Use common abbreviations (I used PT for 270 00:29:18,029 --> 00:29:24,629 "pen test") and if a folder/directory -- I put in "folder" here because these tips 271 00:29:24,629 --> 00:29:29,940 are not Linux specific, they apply equally to Windows or to any other 272 00:29:29,940 --> 00:29:35,429 operating system -- but if you do see your container object (whatever it's called) 273 00:29:35,429 --> 00:29:39,750 start to have too much information and it starts to become unwieldy, create 274 00:29:39,750 --> 00:29:46,080 subfolders and sub-directories. A few possible ways you can organize things 275 00:29:46,080 --> 00:29:51,120 are completed versus incomplete, so if you've got different files for different 276 00:29:51,120 --> 00:29:54,870 projects, when you've finished a particular file -- you've done the work 277 00:29:54,870 --> 00:29:57,899 that is involved with that file -- you can move it from the "incomplete" to the 278 00:29:57,899 --> 00:30:03,509 "completed" directory. You might organize things by file type, so you'll have all of 279 00:30:03,509 --> 00:30:06,899 your workbooks together, all your documents in a separate directory, all of 280 00:30:06,899 --> 00:30:13,200 your slideshows in a third. You might wish to organize things by project -- that 281 00:30:13,200 --> 00:30:16,710 is, in essence, what we did here -- where we had client1, client2, client3, and 282 00:30:16,710 --> 00:30:24,000 each client involved a separate pen test. If you're dealing with Windows, 283 00:30:24,000 --> 00:30:27,810 put your documents in the document folder, create subfolders within the "Document" folder. 284 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 285 00:30:34,320 --> 00:30:41,370 you can see my taskbar so I can demonstrate a jump list. If I right-click 286 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 287 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 288 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 289 00:31:03,810 --> 00:31:09,270 added new files, open up new files, the older ones will drop from the list. If 290 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 291 00:31:14,340 --> 00:31:19,620 clicking on the pushpin. I can unpin a pinned item by clicking on the push pin 292 00:31:19,620 --> 00:31:27,510 again. You might wish use the recent items on the start menu, but if for security 293 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 294 00:31:30,990 --> 00:31:35,750 wish to have a jump list, there are ways of getting rid of those as well. 295 00:31:35,750 --> 00:31:42,360 If you have certain files that you open very, very, very frequently, you might wish 296 00:31:42,360 --> 00:31:46,650 to create a desktop shortcut in Windows to the particular item. That way, 297 00:31:46,650 --> 00:31:52,680 you can go to it directly without having to navigate the folder structure. If you 298 00:31:52,680 --> 00:31:58,710 are trying to find particular files, you can go into "computer" and for our 299 00:31:58,710 --> 00:32:02,220 discussion right now. I'd actually like to talk a little bit about how things 300 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 301 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 302 00:32:14,130 --> 00:32:18,510 allowed to make changes. I think the u: drive is an excellent example of 303 00:32:18,510 --> 00:32:23,610 organization. Even if you've never looked at the u: drive before, if you know that 304 00:32:23,610 --> 00:32:28,020 this video is for our CIS 141 class, you'd be able to just glance at 305 00:32:28,020 --> 00:32:31,620 the names of these folders. They're very short but they're descriptive. You should 306 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 307 00:32:36,420 --> 00:32:40,400 happen to know that my last name is "Mancini," you'd be 308 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 309 00:32:45,530 --> 00:32:52,970 have information that is relevant, and then from here again you can go into the 310 00:32:52,970 --> 00:32:58,820 relevant folder. At this point, I'd like to look at the folder that just says 311 00:32:58,820 --> 00:33:03,050 "Windows." This contains a number of miscellaneous files for the purposes 312 00:33:03,050 --> 00:33:10,190 of practicing organization. Again, this is a relatively small number of 313 00:33:10,190 --> 00:33:14,150 files in this folder, but pretend that there were quite a number and we wish to 314 00:33:14,150 --> 00:33:20,120 find a particular one. I happen to be in the "Details" view right now. You can 315 00:33:20,120 --> 00:33:25,010 change your view by going to the View menu. You're going to "Details." If you 316 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 317 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 318 00:33:37,340 --> 00:33:42,200 bring up the View menu. We're currently in the details view now. The 319 00:33:42,200 --> 00:33:46,670 nice thing about the details view -- or one of the nice things beyond the fact that 320 00:33:46,670 --> 00:33:50,120 it gives you a lot more information about all the different files -- is that 321 00:33:50,120 --> 00:33:54,140 you can organize things quickly. If you knew that the file you were interested 322 00:33:54,140 --> 00:33:59,150 in was one that had been modified fairly recently, you can click on "Date Modified," 323 00:33:59,150 --> 00:34:04,970 and if you click on it once, it organizes things from the most recently to the 324 00:34:04,970 --> 00:34:08,659 least recently modified files. These files haven't been modified in quite a 325 00:34:08,659 --> 00:34:14,690 while. If you click on it again, it reverses the organization. If you knew 326 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 327 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 328 00:34:21,649 --> 00:34:29,210 rid of, you could sort by size. The default order is sorting by name, and if 329 00:34:29,210 --> 00:34:33,859 you happen to have a mixture of both files and folders, the folders by default 330 00:34:33,859 --> 00:34:39,800 will show up first a through , then the ordinary files a through z. So, again, I 331 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 332 00:34:44,179 --> 00:34:49,040 CIS 141 student at Delaware Technical Community College, be sure to 333 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 334 00:35:01,490 --> 00:35:08,830 -i option, rm without any options. Practice the globbing 335 00:35:08,830 --> 00:35:17,240 character, the asterisk. Be prepared to come into class and be able to do 336 00:35:17,240 --> 00:35:21,980 something similar to what was done in this particular presentation.You will be 337 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 338 00:35:27,920 --> 00:35:33,230 to come up with an appropriate organization for. Again, I hope you found 339 00:35:33,230 --> 00:35:37,730 this video interesting and useful and informative. If you have any questions, 340 00:35:37,730 --> 00:35:41,170 please do speak with your instructor