Welcome in this video. I want to talk about using compression utilities on the command line on Mac and potentially Linux -
so
I've installed a couple different command line utilities on here
The Mac will come with things like gzip and bzip2 and you can install other
Utilities I use the Mac port system to do that
I'll put a link in the description to my Mac ports video that I did on installing that
So in my last video we talked about tar and that takes a group of files and puts them into one unit
So what I have here is this data tar is?
This I've combined everything in the data folder into this so
you can add a flag to your tar to compress it but
For a sake of argument. Let's say you can't do that and you want to zip this up so
Our common utility people use as gzip. So we'll look at gzip will type gzip space -h and
we have the the
Help file here. You can look at the compression
levels here and
I often just use nine computers are pretty fast see today. So I want the smallest file and
Then there's this c or right to standard out. We'll talk about that
And the important thing to note here is that it says keep original files
so
And then there's other things you can recurse into directories things like that
So if we want to compress this we can type gzip space
- nine and then the data tar and this will compress this
Okay, if we look at our directory again
We have it compressed but you'll notice it got rid of the data tar, and that may be okay
Or you may not want it that way so to uncompress this
I'll type gzip space - D for decompressed and then data
tar.gz
I'll run that and then we have it back. So let's assume we want to keep data tar
So you have things in this file and someone wants a copy. You still want the tar?
Unchanged or say it's some other you know, like a big text document
So what we can do here is we can say gzip
space - nine and then see which will
Pass the output to standard out and this will also keep the file intact
so we type data tar and if we ran this like this this would create a bunch of
illegible stuff on the screen so we want to
Do a greater than symbol which will send this to a file and then we'll name the file data tar.gz
if we run this
What we end up with is this the tar is there and then the compressed file both
So there's different utilities work in different ways
So you want to look at the help file for the utility you want to use? So let's clear the screen here
Let's look at bzip
bzip2
and bzip2 also has this -c option here
So it's the same thing if you just be zip something it will delete it after it's done
otherwise it will keep it there and then if we look at
xz
same thing here this
-c
so
So in contrast you have something like 7-zip and 7-zip can
do the same thing as tar and gzip together, but say you just want to use the compression in 7-zip if we type 7z
space a for add to the
7-zip archive and then look like data tar dot 7z and then data tar
Okay, so this will
compress it and it will keep the
original there
So you see we still have the data tar and then we have the second file here and it hasn't been
Changed so so that's those are the basics of compressing on the command-line. There are
Many different things you can do with those but I just wanted to get the basics you can play around with them a bit
You know
you can probably like take a
folder with a bunch of files in it and
Make a copy of it and play around with these a bit and learn
But if you have any questions, please leave them in the comments
If you like this video, please click like if you haven't subscribed my channel
I would appreciate if you could do that and thanks for watching until next time. Goodbye