Hello, and welcome to this presentation from Pluralsight.
My name is Andrew Mallet,
and I'm going to be your instructor as I help guide you through the
module, Backing Up and Compressing Files in Linux.
So here you go.
What are we going to be taking a look at as we work our way through?
Well, of course we'll be looking at the archiving utility, tar.
Don't worry about the t for tape archive.
We can use it to back up to disk, as well as, obviously, tapes.
We'll be looking at how we can compress those archives,
either independently or using options within the tar command.
And we'll be taking a look at another utility for creating archives,
and that's the cpio command, the copy, input,
output command, and we'll see why that can be quite useful as well.
So when you're ready, sat comfortably, we shall begin.
The first thing we'll take a look at is creating these tar files,
our tape archives.
When we go through and take a look, let's say,
for example, at the size of our etc directory,
you can see that we're using the du, disk utilization; we want a summary,
because we're looking at the directory; and then
we're using h for human readable.
Now we're seeing then that we can see 22 MB on this particular system.
As we then go through and create our archive, ‑c is for create,
and then we can specify the file we want to back up
to and what we want to back up.
As we then look at the created archive file, we can see then that it's 21 MB.
Now, a lot of people are going to think then when we look at this,
ah, it's compressed, because it's smaller.
No.
It's smaller because it's making better efficiency
of the underlying disk blocks.
On most Intel‑based systems, the block size is going to be 4K.
That's the smallest amount of disk that we can write to,
so there's going to be a lot of wasted space.
So by writing to a single file instead of having many small files,
we've got potentially much less wastage going on.
Now we saw the option ‑c to create, and,
of course, we use that then to create our archive.
We can use the ‑c or ‑‑create, if we prefer our long options.
‑t, I always say for table of contents,
but it's ‑t or ‑‑verify if we want to actually check
then the contents of an archive file.
To extract, then it's ‑x or ‑‑extract.
We're going to be using the short options because,
well,
quite simply, I know them and they're much shorter to type. But
obviously, it documents it better if we use the long options, so
maybe in scripts you might consider using the long options, but
you're certainly going to become used to the short options when
you're using it frequently.
Now of course, these slides are going to give you a great
introduction, but what I'd really like you to do now is get
ready on your AlmaLinux system,
and we're going to be running through some of these demonstrations from the command line.