File Details Flashcards
The term file refers to…?
Regular files, directories, symbolic links, device nodes, anothers.
All files have common attributes….?
User owner, group owner, permissions, and timing information. This information is stored in a structure called an inode.
File names are contained in data structures called…?
dentries (directory entries).
A file’s inode information can be examined with the…?
ls -l and stat commands.
Within the Linux kernel, files are generally identified by…?
inode number. The ls -i command can be used to examine inode numbers.
Three Components Linux associates with a file.
- 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.
There are ______ structures associated with every file.
Three.
Dentry…?
contains a filename and refers to an inode, which contains the file’s metadata and refers to the file’s data.
See figure 1.1 for File Structures.
https://academy.redhat.com/courses/rha030-6.1/rha030_fsmngt_filedetail.html#rha030_fsmngt_filedetail_discussion
What’s in an inode…?
Stores all the file’s information, except for the filename.
What can be found in an inode…?
- Filetype
- Ownerships and Permissions
- Timing Information
- File length and size
- Link Count
Inode:
File Type…?
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.
Possible Linx/Unix File Types:
Regular file’s ls Abbreviation and Use…?
-
Storing data.
Possible Linx/Unix File Types:
Directories ls Abbreviation and Use…?
d
Organizing files
Possible Linx/Unix File Types:
Symbolic Links ls Abbreviation and Use…?
l
Referring to other files
Possible Linx/Unix File Types:
Character Device Nodes ls Abbreviation and Use…?
c
Accessing Devices.
Possible Linx/Unix File Types:
Block Device Nodes ls Abbreviation and Use…?
b
Accessing devices
Possible Linx/Unix File Types:
Named Pipes ls Abbreviation and Use…?
p
Interprocess communication.
Possible Linx/Unix File Types:
Sockets ls Abbreviation and Use…?
s
Interprocess Communication.
The seven file types all use the same inode structure, so they each have the same….?
types of attributes: owners, permissions, modify times, etc.
Note
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 (-)”.
Ownerships and Permissions….?
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.
When listing files with ls -l, the first column displays….?
the permissions (as well as file type), the third the user owner, and the fourth the group owner.
Timing Information:
Each inode stores three times relevant to the file, conventionally called the…?
atime, ctime, and mtime.
These times record the last time a file was accessed (read), changed, or modified, respectively.