Chapter 3 - Essential File Management Tools Flashcards

1
Q

What defines the layout of the linux file system?

A

Filesystem Hierarchy Standard

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what does “/boot” contain?

A

Contains all files and directories that are needed to boot the Linux kernel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what does “/dev” contain?

A

Contains device files that are used for accessing physical devices. This directory is essential during boot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what does “/etc” contain?

A

Contains configuration files that are used by programs and services on your server. This directory is essential during boot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what does “/home” contain?

A

Used for local user home directories.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what does “/mnt”, “/media” contain?

A

Contain directories that are used for mounting devices in the file system tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does “/opt” contain?

A

Used for optional packages that may be installed on your server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does “/proc” contain?

A

Used by the proc file system. This is a file system structure that gives access to kernel information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does “/root” contain?

A

The home directory of the root user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what does “/run” contain?

A

Contains process and user-specific information that has been created since the last boot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what does “/srv” contain?

A

May be used for data by services like NFS, FTP, and HTTP.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what does “/sys” contain?

A

Used as an interface to different hardware devices that is managed by the Linux kernel and associated processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what does “/tmp” contain?

A

Contains temporary files that may be deleted without any warning during boot.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what does “/usr” contain?

A

Contains subdirectories with program files, libraries for these program files, and documentation about them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what does “/var” contain?

A

Contains files that may change in size dynamically, such as log files, mail boxes, and spool files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are some common directories that are mounted on separate dedicated devices?

A

/var
/home
/usr
/boot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which command gives the output of all mounted devices?

A

“mount” command. To get this information, the “/proc/mounts” file is read, where the kernel keeps information about all current mounts. It shows kernel interfaces also, which may lead to a long list of mounted devices being displayed

18
Q

Command to show available disk space on mounted

devices?

A

df -Th

19
Q

Which command shows mounts and the relationship that exists between the different mounts?

A

findmnt

20
Q

What is absolute pathname?

A

An absolute filename, or absolute pathname, is a complete path reference to the file or directory you want to work with. This pathname starts with the root directory, followed by all subdirectories up to the actual filename. No matter what your current directory is, absolute filenames will always work. An example of an absolute filename is “/home/lisa/file1”

21
Q

What is a relative pathname?

A

A relative filename is relative to the current directory as shown with the pwd command. It contains only the elements that are required to get from the current
directory up to the item you need. Suppose that your current directory is “/home” (as shown by the pwd command). When you refer to the relative filename “lisa/file1”, you are referring to the absolute filename “/home/lisa/file1”

22
Q

Where does linux store administrative data about files?

A

inodes. The inode is used to store all
administrative data about files. Every file on Linux has an inode, and in the inode,
important information about the file is stored:
- The data block where the file contents are stored
- The creation, access, and modification date
- Permissions
- File owners

23
Q

Which is the one important information that is not stored in the inode?

A

name of the file. inode does not know which name it has; it just knows how many names are associated with
the inode

24
Q

What is a hard link?

A

inode does not know which name it has; it just knows how many names are associated with the inode. These names are referred to as hard links. When you create a file, you give it a name. Basically, this name is a hard link

25
Q

Mention some important informtation about hardlinks

A
  • Hard links must exist all on the same device (partition, logical volume, etc).
  • You cannot create hard links to directories.
  • When the last name (hard link) to a file is removed, access to the file’s data is also removed
26
Q

What is a Symbolic link?

A

A symbolic link (also referred to as soft link) does not link directly to the inode but to the name of the file.

27
Q

Mention some important informtation about soft links

A
  • it is more flexible but has many disadvantages
  • when the original file is removed, the symbolic link becomes invalid and does not work any longer
  • symbolic links is that they can link to files on other
    devices, as well as on directories
28
Q

Which command is used to create a hard link?

A

ln

29
Q

Which command is used to create a soft link?

A

ln -s

30
Q

How to check whether a file is a link?

A

use the “ls” command to see if the file is a link. If a file is a hard link, “ls -l” shows the hard link counter. If a file is a symbolic link, the output of ls -l shows the name of the item it links to after the filename

31
Q

which command is used to create a archive?

A

tar. The Tape ARchiver (tar) utility is used to archive files

32
Q

Which command is used to compress a tar file?

A

use option -z with tar command. “tar -cvzf”

33
Q

How to use tar command to create a archive?

A

tar -cf archivename.tar /files-you-want-toarchive

34
Q

What option to use to add files to an already existing archive?

A

-r option. example : tar -rvf /root/homes.tar /etc/hosts

35
Q

What option to use to update a currently existing archive file?

A

-u option. example : tar -uvf /root/homes.tar /home

36
Q

How to list the contents of an archive file without extracting the archive file?

A

-t option. Example : tar -tvf /root/homes.tar to see the

contents of the tar archive.

37
Q

How to extract the contents of a archive file?

A

tar -xvf /archivename. The -x option to extract.

38
Q

Which option to use the specify the directory where you want to extract the archive contents to?

A

“-C /targetdir” to specify the target directory. Example :

tar -xvf homes.tar -C /tmp.

39
Q

How to extract just one file out of an archive file?

A

tar -xvf /archivename.tar file-you-want-to-extract

40
Q

which command to use to decompress the compressed file?

A

gunzip

bunzip2