This chapter is about files, rights, and file commands. It begins with a review of some file commands you should remember from Linux I.
The text provides some examples of these commands and several others. Note the refresher in this section abut wildcards. The main two are * (which matches anything, of any length, including nothing) and ? (which matches one character in the position indicated by your search command). Review this section as well.
The text mentions four compression utilities that can be used on Linux system. It warns that you typically need the same utility to decompress a file that was used to compress it, but that is not necessarily so, as discussed in this article about such products. It discusses all four from the chapter and eleven more.
You may also wish to check into 7zip and rar.
The text continues with some tools for making archives. I had to read the description of the tar utility twice before I realized that a tar file does not necessarily use compression. This seems odd to me, since any such program I have ever used on a PC also made the resultant file smaller than the initial file or files. Maybe saving space is not important to some people? The video below discusses gzip, bzip2, and tar.
The text turns to a more troublesome topic on page 213, links to files and folders. Links come in two types: hard and soft. Hard links are discussed first.
Hard links are created with the ln command. They are created to give a file or folder more than one name. This should feel wrong to you. In the example in the text, a new file is created in a folder, Let's call it file1. A second filename is created in the same folder with a command like this:
ln file1 file2
Both filenames point to the same file, as can be seen with the command ls -i, which shows the inodes that filenames are connected to. In the example below, note that the two filenames I used are connected to the same inode.
This example shows that creation of a hard link is easy. You should review these rules for creating them:
Soft links (symbolic links) are a bit trickier, because they can point to data on a different filesystem. The also have different inode numbers. In the example below, I have created a soft link with the ln -s option, and displayed the inode information.
The rules for soft links are different in three respects:
The text continues with some advice about using links, which is welcome but not very informative. Let's try a friendly video.
As the presenter says, if you delete either the original filename or a hard link to it, you still have the other filename to access the data/executable. If you delete a soft link, you still have the original. If you delete the original filename, the soft link is useless because it points only to the original filename which no longer exists..
The next topic is file ownership, also called file permissions. You should be familiar with the chmod and chown commands.You may not have seen the chgrp command which is handy for a hacker. If you use chgrp on a file you own, you can change the assigned group to any group you belong to. A root level user, however, can change the assigned group to any group, which makes it more possible for a hacker to create a group that will be assigned rights to files as the hacker pleases.
If you are not familiar with file permissions, review the notes about them in my Linux I course.
The text also mentions some useful file commands that are not always covered.
You should review the parameters listed for locate and find as they are probably less familiar to you.