Linux file system Flashcards
What is the -l flag in the ls linux command?
Long listing
Shows metadata about files, including permissions
What are the components of the ls -l listing?
File type (e.g. d or -)
Permissions (rw-r–r–)
Extended attributes (.)
User owner
Group owner
What does the filetype - mean?
No special type (normal file)
How is filetype formatted in the ls -l command?
The first symbol, in front of permissions:
Filetype: -
-rw-r–r–
Filetype: d (directory)
drw-r–r–
What is XFS?
Default filesystem format in Red Hat Linux 7, 8 and 9
High-performing, journaling file system
How are file permissions formatted?
In 3 sets of permissions
rw-r–r–:
Owner: rw-
User group of the owner: r–
Others: r–
What are the representations in symbolic mode?
u: user owner
g: group owner
o: Others
r: read
w: write
x: execute
How does the system run through when a user interacts with a file?
- First check if user is the owner. If so, grant owner permissions, run no further checks.
- Next, the users group membership is validated to see if they belong to the owner group. If so, group permissions are granted. No further checks.
- “other” permissions are applied if the two previous checks fail.
What does a user’s permission expression contain?
Expression include 3 basic types of permission: r, w, x
Each character indicates if a permission is granted
symbol: granted
-: not granted
How can permissions be represented in numeric mode?
a 3-digit value represents specific file permissions, called octal values.
First digit is owner, second is group, third is other.
r: 4
w: 2
x: 1
If the owner has value 7, it means the permissions are as such:
rwx = 4+2+1 = 7
If the group has value 4, the permissions are:
r– = 4+0+0 = 4
What does the read permission allow a user?
Access file content, e.g. through using the command cat or less or an editor.
What is the cat command?
Concatenate files and print on the standard out
If we use cat on multiple files, the file contents will be concatenated and sent to stdout
cat file1 file2
result:
file1 contents
file2 contents
What permissions are required to copy a file?
read
What does the write permission allow a user?
Modify content of file
Allows the user to use the redirect or append operators in the shell (> and»_space;) to change the contents of a file
What does the execute permission allow a user?
Allows to execute the contents of a file.
Allows to run bash script, python files and interpreted languages.
The contents are typically commands or compiled binary applications.
What is the redirect operator in shell?
command > filename
Redirect the output of a command to for example a file.
File is created if it does not exist, and overwritten if it does.
What is the append operator in shell?
command»_space; filename
Used to append the stdout of a command to a file.
Can be used to e.g. append data to a log file.
File is created if it does not exist, data appended if it does.
What is the default stdin device (standard input)
Keyboard
What is the default stdout device (standard output)
Screen or particular terminal window
What is redirection of output?
When we want to put output of a command in a file (>) or issue another command on the output of one command.
What does the | (pipe) operator do?
Sends the stdout of one command as stdin of another command.
What is the difference between the > and the»_space; operator?
> replaces content of a file, whereas»_space; appends to the content of a file
How can the contents of a file be executed when we do not have the execute permissions?
Use an interpreter that has execute permissions to read a file with instructions for the interpreter to execute.
Example: Invoking a bash shell script:
bash script.sh
The executable being run is bash
script.sh is only being read by the Bash interpreter