File Details Flashcards

1
Q

The term file refers to…?

A

Regular files, directories, symbolic links, device nodes, anothers.

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

All files have common attributes….?

A

User owner, group owner, permissions, and timing information. This information is stored in a structure called an inode.

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

File names are contained in data structures called…?

A

dentries (directory entries).

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

A file’s inode information can be examined with the…?

A

ls -l and stat commands.

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

Within the Linux kernel, files are generally identified by…?

A

inode number. The ls -i command can be used to examine inode numbers.

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

Three Components Linux associates with a file.

A
  • Data
    The data is the content of the file, in this case, the 16 bytes that compose elvis’s shopping list (13 visible characters, and 3 invisible “return characters that indicate the end of a line). In Linux, as in Unix, every file’s content is stored as a series of bytes.
  • Metadata
    In addition to its content, every file in Linux has extra information associated with it. The entire last Workbook focused on some of this information, namely the file’s user owner, group owner, and permissions. Other information, such as the last time the file was modified or read, is stored as well. Much of this metadata is reported when you run the ls -l command. In Linux (and Unix), all of the extra information associated with a file (with the important exception discussed next) is stored in a structure called an inode.

-filename
The filename is the exception to the rule. Although the filename could be considered metadata associated with the file, it is not stored in the inode directly. Instead, the filename is stored in a structure called a dentry. (The term dentry is a shortening of directory entry, and, as we will see in a later Lesson, the structure is closely associated with directories.) In essence, the filename associates a name with an inode.

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

There are ______ structures associated with every file.

A

Three.

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

Dentry…?

A

contains a filename and refers to an inode, which contains the file’s metadata and refers to the file’s data.

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

See figure 1.1 for File Structures.

A

https://academy.redhat.com/courses/rha030-6.1/rha030_fsmngt_filedetail.html#rha030_fsmngt_filedetail_discussion

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

What’s in an inode…?

A

Stores all the file’s information, except for the filename.

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

What can be found in an inode…?

A
  • Filetype
  • Ownerships and Permissions
  • Timing Information
  • File length and size
  • Link Count
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Inode:

File Type…?

A

term file has a very general meaning: anything that exists in the filesystem (and thus has an inode associated with it) is a file. This includes regular files and directories, which we have already encountered, symbolic links and device nodes, and a couple more obscure creatures which are related to interprocess communication, and beyond the scope of the course.

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

Possible Linx/Unix File Types:

Regular file’s ls Abbreviation and Use…?

A

-

Storing data.

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

Possible Linx/Unix File Types:

Directories ls Abbreviation and Use…?

A

d

Organizing files

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

Possible Linx/Unix File Types:

Symbolic Links ls Abbreviation and Use…?

A

l

Referring to other files

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

Possible Linx/Unix File Types:

Character Device Nodes ls Abbreviation and Use…?

A

c

Accessing Devices.

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

Possible Linx/Unix File Types:

Block Device Nodes ls Abbreviation and Use…?

A

b

Accessing devices

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

Possible Linx/Unix File Types:

Named Pipes ls Abbreviation and Use…?

A

p

Interprocess communication.

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

Possible Linx/Unix File Types:

Sockets ls Abbreviation and Use…?

A

s

Interprocess Communication.

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

The seven file types all use the same inode structure, so they each have the same….?

A

types of attributes: owners, permissions, modify times, etc.

21
Q

Note

A

The term file is overloaded in Linux (and Unix), and has two meanings. When used in sentences such as “every file has an inode”, the term refers to any of the file types listed in the table above. When used in sentences such as “The head command only works on files, not directories”, the term file is referring only to the specific type of file that holds data. Usually, the meaning is clear from context. When a distinction has to be made, the term regular file is used, as in “The ls -l command identifies regular files with a hyphen (-)”.

22
Q

Ownerships and Permissions….?

A

very (regular) file and directory has a group owner, a user owner, and a collection of three sets of read, write, and execute permissions. Because this information is stored in a file’s inode, and the inode structure is the same for all files, all seven file types use the same mechanisms for controlling who has access to them, namely chmod, chgrp, and chown.

23
Q

When listing files with ls -l, the first column displays….?

A

the permissions (as well as file type), the third the user owner, and the fourth the group owner.

24
Q

Timing Information:

Each inode stores three times relevant to the file, conventionally called the…?

A

atime, ctime, and mtime.

These times record the last time a file was accessed (read), changed, or modified, respectively.

25
Q

File times:

Access Time, Abbreviation and Purpose…?

A

atime

Updates whenever the file’s data is read.

26
Q

File times:

Change Time, Abbreviation and Purpose…?

A

ctime

Updates whenever the file’s inode information changes.

27
Q

File times:

Modify Time, Abbreviation and Purpose…?

A

mtime

Updates whenever the file’s data changes.

28
Q

What’s the difference between change and modify?

A

When a file’s data changes, the file is said to be modified, and the mtime is updated. When a file’s inode information changes, the file is said to be changed, and the file’s ctime is updated. Modifying a file (and thus changing the mtime) causes the ctime to update as well, while merely reading a file (and thus changing the atime) does not cause the ctime to udpate.

29
Q

What about create time?

A

Often, people mistake Unix’s ctime for a “creation time”. Oddly, traditional Unix (and Linux) does not record the fixed time a file was created, a fact which many consider a weakness in the design of the Unix filesystem.

30
Q

File length and size…?

A

The inode records two measures of how large a file is: The file’s length (which is the actual number of bytes of data), and the file’s size (which is the amount of disk space the file consumes). Because of the low level details of how files are stored on a disk, the two differ. Generally, the file’s size increments in chunks (usually 4 kilobytes) at a time, while the length increases byte by byte as information is added to the file. When listing files with the ls -l command, the file’s length (in bytes) is reported in the 5th column. When listing files with the ls -s command, the file’s size (in kilobytes) is reported instead.`

31
Q

Link Count…?

A

Lastly, the inode records a file’s link count, or the number of dentries (filenames) that refer to the file. Usually, regular files only have one name, and the link count as one. As we will find out, however, this is not always the case. When listing files with ls -l, the second column gives the link count.

32
Q

Red Hat Enterprise Linux includes the stat command for examining a file’s inode information in detail. In Unix programming, a file’s collection of inode information is referred to as the status of the file. The stat command can be thought of as reporting the…?

A

status of a file.

33
Q

Stat switch:

-c, –format=FORMAT…?

A

Print only the requested information using the specified format. See the stat(1) man page for more information.

34
Q

Stat switch:

-f, –filesystem…?

A

Show information about the filesystem the file belongs to, instead of the file.

35
Q

Stat switch:

-t, –terse…?

A

Print output in terse (single line) form.

36
Q

While the stat command is convenient for listing the inode information of individual files, the ls command often does a better job…?

A

summarizing the information for several files.

37
Q

ls switch:

-a, –all…?

A

Include files that start with .

38
Q

ls switch:

-d, –directory…?

A

If FILE is a directory, list information about the directory itself, not the directory’s contents.

39
Q

ls switch:

-F, –classify

A

Decorate filenames with one of *,/,-,@, or | to indicate file type.

40
Q

ls switch:

-h, –human-readable…?

A

Use “human readable” abbreviations when reporting file lengths.

41
Q

ls switch:

-i, –inode…?

A

List index number of each file’s inode.

42
Q

ls switch:

-l…?

A

Use long listing format.

43
Q

ls switch:

-n, –numeric-uid-gid

A

Use numeric UIDs and GIDs, rather then usernames and groupnames.

44
Q

ls switch:

-r, –reverse…?

A

Reverse sorting order.

45
Q

ls switch:

-R –recursive…?

A

List subdirectories recursively.

46
Q

ls switch:

–time=WORD…?

A

Report (or sort by) time specified by WORD instead of mtime. WORD may be one of “atime”, “access”, “ctime”, or “status”.

47
Q

ls switch:

-t…?

A

Sort by modification time.

48
Q

While people tend to use filenames to identify files, the Linux kernel usually uses…?

A

the inode directly. Within the filesystem, every inode is assigned a unique inode number. The inode number of a file can be listed with the -i command line switch to the ls command.

49
Q

when using ls -s command, next to each filename, the ls command reports…?

A

the size of the file in kilobytes. (For example ash takes up 96 Kbytes of disk space. In the (abbreviated) output, that all of the sizes are divisible by four. Apparently, when storing a file on the disk, disk space gets allocated to files in chunks of 4 Kbytes. (This is referred to as the “blocksize” of the filesystem).