all right house is welcome back and in
this video I am going to show you how to
compress and decompress files and also
directories so you know whenever you're
just working with windows if you have a
file that you want to compress or maybe
have a zip file that you want to extract
you can just right-click it and then you
menu pops up and you're like extract all
well that works great on windows but
from the command-line we don't have that
luxury we just can't you know
right-click something and have a menu
pop up so whenever you're working on a
server from a remote location you need
to learn how to do from the command line
and this is first let me show you guys
how to just compress a single text file
in these files they're not special I
just you know added some random you know
crap like this in them nothing important
so let's just go ahead and compress this
one grocery list so the program is
called gzip and then after this just
type the name of the file really simple
now if you start typing grocery lists
and hit tab it's going to pop up and
another thing I want to point out is
this so whenever you have a file name
and it has a space in it such as grocery
list
well usually whenever you're running
commands from a terminal whenever you
have a space it means do something else
either at a you know additional
parameter or maybe um you know a new
file name or a new program well now we
just saying um no this is just one file
there's just a space in it so that's why
whenever I start typing it added this
backslash because the backslash tells
the boom - hey whatever character comes
after this then just read it as the
space and not you know a new command so
there you go if I hit enter check out
what happens it takes grocery list and
it compresses it into a GZ or compressed
file so if you ever want to extract it
or decompress it then we can use is guns
if now whenever you use guns if remember
since this is a compressed file it has
the dot GZ extension so don't forget
that and you can just hit enter
and it decompresses it boom roasted now
a lot of people don't really care about
doing this with a single file but they
use it for multiple files so say for
example I wanted to send this to someone
over the internet but it was too big so
I need to take both of these and
compress them into a single tar file and
the tar file is kind of like the
equivalent of a zip file for Windows so
what do I do in this case is type tar
and why the f did it pop down there
CVF in what these parameters mean right
here are our break it down into you know
C first so C means create mode so we're
going to create something nothing new v
means display the output in the terminal
so once this is done in the command is
ran then I mean I was just going to give
us a little notification of what it did
you can leave it out if you want if you
don't want to see anything but you know
I like to verify that the program works
successfully so there you go and this F
these are just the file options so the
arguments that come after this um well
I'll show you guys what what they are
right now so the first thing is hey
you're taking these and you're putting
them into a new zip file what's the name
of the zip aka tar file I'll just name
it like um lucky you are
and that says ok so this is the tar file
now what do you want to add to it well
I'm just going to add grocery lists and
also favourite movies so you basically
write tar czf what do you want the name
of your tar file to be and what files do
you want to compress and stick in it
well it's going to go through and boom
look at that so if you ever want to
extract it or unzip it you guys may be
more familiar with that term you just
use tar x VF now remember see this is
pretty much the same thing is when we
compress that but we're extracting it
the only thing different is this X so X
means extract C means create a file X
means extract it so they're really easy
to remember
and you just write the name of whatever
you're trying to extract you don't need
the files inside and boom check it out
so since they were already you know I
already had them on my desktop you guys
probably you know didn't notice I'm
flashing real quick but they were
extracted guys just have to trust me I
guess so anyways that is how you
compress and decompress individual files
and also how you can press and
decompress multiple files into a tar
directory then guys for watching
see you next time