So starting with the find command, a size smaller than 1000 bytes.
Okay, let's go man find and in man find, let's use minus
size to look for what exactly we can do with size.
And there you can see that minus size takes a plus n, a minus n,
or an n where minus n is for less than n. That's what I need.
Can we find more information? I'm using n in the man page to repeat my
last find there. I can see that size N takes a suffix c w b
k uppercase m, uppercase g. Well, we are looking for bytes, so c for bytes.
That makes 1000c.
All right, so sudo find etc type f. I want to
find files only size 1000c. That should be doing it.
Now, before I'm going to work on the second part, I want to verify that what
we get here is accurate. And probably it is. I see a nice list of files.
So we need to copy these to the TMP files pictures.
Aha, TMP files pictures. Do we still have that?
We worked on it in a previous lab, but honestly not sure.
So let's use an mkdir p TMP files pictures.
The directory existed. Well, that is okay.
Now I can repeat my command and use a exec, because exec is what
you use to run a command on the result of the previous find command.
I'm using cp no further specification because we already have files only, so
we don't need any recursive or whatsoever curly braces to refer to the
result of the find command. And we copy to TMP files pictures, and
then we need to close the exec statement using a backslash semicolon.
Now let's check using LS l on TMP files pictures, that is showing all these files and
I don't see one single file with a size bigger than 1,000 bytes. That's exactly as intended.
Next, we need to create a symbolic link to VAR in TMP files.
Well, I would like to go into the TMP files directory and use LN s to make that a symbolic link.
So in a symbolic link we first specify what we want to link and then where we
want to link it. Well, where we want to link it, that's dot for the current directory.
So when I use LS then I can see var in light blue. And if I don't believe the light
blue, I use LS l where we can see that var is pointing to var. That's what we needed.
Then we need to create a compress archive file of the home directory.
I'm not saying where it is. Well, let's create it in the current directory. Why not?
So TAR C, even if it can do without a minus, I like consistency,
so I like putting a minus in front of my command line options.
And then Z for compression, V for verbose, which is showing what is going on.
An F for file and then I call it home tgz, that's
a common extension that is used for tar gzip compressed files.
And next I'm using home to put the home directory in there.
Oh boy, I'm getting a permission denied. Yes, of course I'm user student and as user student, I can't
read the home directories of all these different users, so I really need a sudo in front of it.
So LS L is showing that the home TGZ is
here. Now I need to extract it into TMP archive.
First I'm using MKDIR archive.
What was again? Well, in relative file names, that brings you up one level.
So it will create the directory TMP archive.
And next I can use tar. Let's put a sudo in front of that, by the way.
So sudo tariff.
The file that I want to Extract is Home TGZ&C
Archive, which will extract it in that specific directory.
And now if I use LS archive, we can see that it has a home directory, so that
should be okay for a little bit more visibility. You might want to consider using 3 instead.
Now I do know that I created a lot of stuff that we really don't know,
so let me use an RM minus RF on archive, on etc and on files.
Obviously it's very important that we are using the relative filenames here relative to the
tmp directory, because you don't want to clean up the etc directory by accident.
Oh boy, I'm doing it again. What am I doing again? Well, I'm forgetting the sudo command.
Hey, you might be tempted to to work without sudo and open a root shell. Don't do that, because if
you open a root shell and you do something without thinking it through properly, you risk damaging your entire system.
It's not that bad if you need to repeat the command sudo in front of it. After all.