1 00:00:01,310 --> 00:00:03,590 Hey, welcome back to this video. 2 00:00:03,920 --> 00:00:12,590 So in this video, we are going to learn about archives and how you can compress files and directories 3 00:00:12,590 --> 00:00:13,580 into Linux. 4 00:00:14,150 --> 00:00:17,570 We are going to see different compression techniques. 5 00:00:17,780 --> 00:00:24,200 Also, we will see how you can zip and unzip or extract those archives. 6 00:00:24,620 --> 00:00:27,170 So let's quickly begin with the first one. 7 00:00:27,260 --> 00:00:34,550 So first, let's quickly go into a directory where we are going to compress a directory. 8 00:00:34,550 --> 00:00:42,020 So let's go and U.F.O. net, which is the directory in which you can see I have already created a directory 9 00:00:42,020 --> 00:00:43,460 named Rohith. 10 00:00:43,700 --> 00:00:46,040 So let's see what's inside it. 11 00:00:46,040 --> 00:00:54,680 And you can see there is a file which is dot text, which contains the content or the text, which is 12 00:00:54,680 --> 00:00:56,520 I love hacking. 13 00:00:56,540 --> 00:01:03,350 All right, so let's go one step back using seed, dot, dot, and now we are back again in the UFO 14 00:01:03,350 --> 00:01:04,790 net directory. 15 00:01:04,820 --> 00:01:05,420 All right. 16 00:01:05,960 --> 00:01:10,010 So the first thing or the first command that we are going to see is TAR. 17 00:01:10,880 --> 00:01:18,290 So basically, we are going to create a tar named archive, which is archive tar, which will contain 18 00:01:18,290 --> 00:01:20,210 the directory, which is root. 19 00:01:20,210 --> 00:01:29,060 And for that the command that we are going to use is tar compress, eff archive, dot tar, which is 20 00:01:29,060 --> 00:01:36,560 the name that we are giving to our archive and the directory that you want to use or which you intend 21 00:01:36,560 --> 00:01:37,850 to be compressed. 22 00:01:37,880 --> 00:01:38,330 All right. 23 00:01:38,330 --> 00:01:43,070 So we have finally compressed Rohit directory into archive to TAR. 24 00:01:43,160 --> 00:01:53,570 Now you can also decompress it or you can decrypt it using the command which is tar x, v, f and the 25 00:01:53,570 --> 00:01:56,210 tar name or the compressed file name. 26 00:01:56,660 --> 00:02:02,960 As you can see, it has finally decompressed it and you can see the content, which is Rohit Slash hacked 27 00:02:03,050 --> 00:02:04,460 text inside it. 28 00:02:04,490 --> 00:02:05,240 Perfect. 29 00:02:06,350 --> 00:02:08,510 Now let us move forward. 30 00:02:08,510 --> 00:02:17,270 And now we are going to see how you can create a GZIP compressed tar file, which is a zip based tar 31 00:02:17,270 --> 00:02:17,780 file. 32 00:02:18,170 --> 00:02:27,260 So for that, the command that we are going to use is tar C said F, you can add the hyphen or the dash. 33 00:02:27,290 --> 00:02:29,940 It is not compulsory without it. 34 00:02:29,960 --> 00:02:32,030 Also the command will work. 35 00:02:32,630 --> 00:02:33,080 All right. 36 00:02:33,080 --> 00:02:42,890 So Tar C, Z, F and archive dot, dot, dot, gz and directory that we want to unzip or compress is 37 00:02:42,890 --> 00:02:43,580 Rohit. 38 00:02:43,610 --> 00:02:51,710 As you can see, it has finally created a zip file which is archive dot dot, dot gz. 39 00:02:51,740 --> 00:02:52,400 Perfect. 40 00:02:52,940 --> 00:02:59,870 So this was the second method or the second way through which we can compress the files. 41 00:03:00,140 --> 00:03:05,090 Now let's quickly extract the gun, zip or g zip files for that. 42 00:03:05,090 --> 00:03:13,220 The command is tar, x, z, f and the archive name which we have recently compressed. 43 00:03:13,220 --> 00:03:15,110 And now this will decompress it. 44 00:03:15,110 --> 00:03:15,740 Perfect. 45 00:03:16,040 --> 00:03:22,670 So in case sometimes you download a few files from the internet or there are some programs or binaries 46 00:03:22,670 --> 00:03:25,430 from GitHub which may be gun zipped. 47 00:03:25,430 --> 00:03:32,030 So this is the command through which you can decompress it and finally use it. 48 00:03:33,590 --> 00:03:34,460 Perfect. 49 00:03:34,550 --> 00:03:35,870 Let's move forward. 50 00:03:35,870 --> 00:03:40,880 And now we're going to choose the same directory, which is right again. 51 00:03:41,060 --> 00:03:47,630 But this time we are going to create a TAA file with B zip two compression. 52 00:03:47,630 --> 00:03:52,160 Now this is again a new technique of compression that we are going to use. 53 00:03:52,190 --> 00:03:59,240 You may come across many times these types of compressed files on GitHub and other various websites. 54 00:03:59,570 --> 00:04:04,880 So that is the main reason I'm showing you how you can create these types of compressed files. 55 00:04:04,880 --> 00:04:12,500 And if in case you have downloaded it, how you can decompress it now to create a B zip to compression, 56 00:04:12,500 --> 00:04:22,280 you simply have to type the command, which is DA, C, G, F and archive dot dot, dot, b, z two 57 00:04:22,460 --> 00:04:25,220 and the directory name which is Rohit Perfect. 58 00:04:25,220 --> 00:04:30,830 So we have successfully created a new archive with B sub two compression. 59 00:04:30,830 --> 00:04:39,440 Now in case you want to decompress it, the command would be tr, x, g, f and archive dot dot visa 60 00:04:39,440 --> 00:04:40,580 to perfect. 61 00:04:40,730 --> 00:04:45,830 This will decompress it again into the original directory, which is Rohit. 62 00:04:46,520 --> 00:04:48,080 So this is it for this video. 63 00:04:48,110 --> 00:04:53,780 I hope you guys understood three methods to compress and decompress the files. 64 00:04:53,810 --> 00:04:54,590 Thank you.