Podcast
Questions and Answers
What does a symbolic link contain?
What does a symbolic link contain?
- A copy of the original file
- The complete file system structure
- A pointer to another file (correct)
- Actual file data
What is contained within the superblock?
What is contained within the superblock?
- File data
- List of all files
- User permissions
- Information about the filesystem (correct)
Which of the following is stored in the inode?
Which of the following is stored in the inode?
- A shortcut to the file
- The Superblock
- The actual file data
- File size and data block locations (correct)
What do hard linked files share?
What do hard linked files share?
What command is used to create a hard link?
What command is used to create a hard link?
Which action reduces the link count for a file?
Which action reduces the link count for a file?
Where must hard linked files reside?
Where must hard linked files reside?
Which command is used to create a new directory in Linux?
Which command is used to create a new directory in Linux?
What is stored in Data blocks?
What is stored in Data blocks?
Which command removes empty directories?
Which command removes empty directories?
What is the primary function of the mv
command?
What is the primary function of the mv
command?
Which command is used to copy files and directories?
Which command is used to copy files and directories?
Which command displays shell aliases?
Which command displays shell aliases?
Which command removes files?
Which command removes files?
What command is used to display the current umask?
What command is used to display the current umask?
Which command is used to search for files in a pre-made indexed database?
Which command is used to search for files in a pre-made indexed database?
Which command recursively searches for files starting from a specified directory?
Which command recursively searches for files starting from a specified directory?
What is the default permission given to new files?
What is the default permission given to new files?
What does the PATH variable contain?
What does the PATH variable contain?
Which of the following special permissions, when set on a file, allows a user executing the file to become the owner of that file during execution?
Which of the following special permissions, when set on a file, allows a user executing the file to become the owner of that file during execution?
To what type of files can SUID be applied?
To what type of files can SUID be applied?
Which command is used to search for an executable file?
Which command is used to search for an executable file?
What is the purpose of the umask
variable?
What is the purpose of the umask
variable?
What is the primary function of the mkdir
command in Linux?
What is the primary function of the mkdir
command in Linux?
The mv
command requires a minimum of how many arguments?
The mv
command requires a minimum of how many arguments?
What is the purpose of the Filesystem Hierarchy Standard (FHS)?
What is the purpose of the Filesystem Hierarchy Standard (FHS)?
Besides moving files, what other function does the mv
command perform?
Besides moving files, what other function does the mv
command perform?
Which of the following is NOT a primary goal of the Filesystem Hierarchy Standard?
Which of the following is NOT a primary goal of the Filesystem Hierarchy Standard?
What type of pathnames can the mv
command use?
What type of pathnames can the mv
command use?
What does the first argument of the mv
command specify?
What does the first argument of the mv
command specify?
Which command is used to create directories?
Which command is used to create directories?
What does the second argument of the mv
command specify?
What does the second argument of the mv
command specify?
What can be used in a pathname for the mv
command when moving multiple files?
What can be used in a pathname for the mv
command when moving multiple files?
Which command is used to copy files in Linux?
Which command is used to copy files in Linux?
What option is used with the cp
command to copy a directory and its subdirectories?
What option is used with the cp
command to copy a directory and its subdirectories?
Which command is used to remove files?
Which command is used to remove files?
What does interactive mode do when using mv
or cp
commands?
What does interactive mode do when using mv
or cp
commands?
Which option overrides interactive mode and forces the command to proceed?
Which option overrides interactive mode and forces the command to proceed?
Which command removes a directory only if it is empty?
Which command removes a directory only if it is empty?
What command displays the aliases present in the current shell?
What command displays the aliases present in the current shell?
Which of the following is a valid use of wildcards with the rm
command?
Which of the following is a valid use of wildcards with the rm
command?
What happens when you use the cp
command to copy a file to a location where a file with the same name already exists?
What happens when you use the cp
command to copy a file to a location where a file with the same name already exists?
If you want to remove a directory that is not empty, which command should you use?
If you want to remove a directory that is not empty, which command should you use?
Flashcards
Symbolic Link (Symlink)
Symbolic Link (Symlink)
A pointer or shortcut to another file.
Hard Link
Hard Link
Two files that share the same data and inode.
Superblock
Superblock
Contains metadata about the filesystem, like the number of inodes and block sizes.
Inode Table
Inode Table
Signup and view all the flashcards
Data Blocks
Data Blocks
Signup and view all the flashcards
Inode Number
Inode Number
Signup and view all the flashcards
ln command
ln command
Signup and view all the flashcards
Hard Link Limitations
Hard Link Limitations
Signup and view all the flashcards
mkdir
mkdir
Signup and view all the flashcards
rmdir
rmdir
Signup and view all the flashcards
mv
mv
Signup and view all the flashcards
cp
cp
Signup and view all the flashcards
alias
alias
Signup and view all the flashcards
rm
rm
Signup and view all the flashcards
unlink
unlink
Signup and view all the flashcards
locate command
locate command
Signup and view all the flashcards
updatedb command
updatedb command
Signup and view all the flashcards
find command
find command
Signup and view all the flashcards
Numeric Representation of Permissions (Mode)
Numeric Representation of Permissions (Mode)
Signup and view all the flashcards
umask variable
umask variable
Signup and view all the flashcards
umask command
umask command
Signup and view all the flashcards
SUID (Set User ID)
SUID (Set User ID)
Signup and view all the flashcards
SUID Effect
SUID Effect
Signup and view all the flashcards
What is the cp
command?
What is the cp
command?
Signup and view all the flashcards
What does cp -r
do?
What does cp -r
do?
Signup and view all the flashcards
What happens when copying or moving to an existing file?
What happens when copying or moving to an existing file?
Signup and view all the flashcards
How to view shell aliases?
How to view shell aliases?
Signup and view all the flashcards
What is interactive mode?
What is interactive mode?
Signup and view all the flashcards
What does the -f
option do?
What does the -f
option do?
Signup and view all the flashcards
What is the rm
command?
What is the rm
command?
Signup and view all the flashcards
Arguments for rm
?
Arguments for rm
?
Signup and view all the flashcards
What is the rmdir
command?
What is the rmdir
command?
Signup and view all the flashcards
What's required to remove a directory with rmdir
?
What's required to remove a directory with rmdir
?
Signup and view all the flashcards
Filesystem Hierarchy Standard (FHS)
Filesystem Hierarchy Standard (FHS)
Signup and view all the flashcards
mkdir command
mkdir command
Signup and view all the flashcards
Source Pathname
Source Pathname
Signup and view all the flashcards
Target Pathname
Target Pathname
Signup and view all the flashcards
Absolute Pathname
Absolute Pathname
Signup and view all the flashcards
Relative Pathname
Relative Pathname
Signup and view all the flashcards
Wildcards
Wildcards
Signup and view all the flashcards
Non-distribution-specific software
Non-distribution-specific software
Signup and view all the flashcards
Purpose of the FHS
Purpose of the FHS
Signup and view all the flashcards
Study Notes
Linux Filesystem Management
- Covers finding files and directories
- Includes linking files, understanding the Filesystem Hierarchy Standard
- Explores managing files and directories with standard Linux commands
- Explains modifying file and directory ownership
- Explains defining and change Linux file and directory permissions
- Shows identifying the default permissions created on files and directories
- Describes applying special file and directory permissions
- Covers modifying the default access control list (ACL)
- Shows how to View and set filesystem attributes
The Filesystem Hierarchy Standard
- Includes standard set of directories for Linux and UNIX systems
- Covers standard file and subdirectory contents
- Simplifies finding specific files
- Gives Linux software developers the ability to locate files on any Linux system
- Supports creating non-distribution-specific software
Managing Files and Directories
- The
mkdir
command creates new directories, using absolute or relative pathnames - The
mv
(move) command moves files and requires a minimum of two arguments: a source file/directory and a target file/directory - Pathnames in
mv
can be absolute or relative, and wildcards can be used for multiple files; also used to rename files. - The
cp
(copy) command copies files - To copy a directory recursively (with all files and subdirectories), use the -r option with
cp
command. - Both the
mv
andcp
commands warn if the target is an existing file and prompt for confirmation in Fedora Linux that has BASH aliases for these commands. - To see shell aliases, type alias at the prompt.
- Interactive mode prompts the user before overwriting files
- The
-f
option withrm
forces overwriting in interactive mode. - The
rm
(remove) command removes files, and takes a list of files as arguments and can use wildcards. - It operates in interactive mode by default, but
-f
overrides this. - The
rmdir
(remove directory) command removes directories, but only if they are empty
Finding Files
- The
locate
command searches for files in the Linux directory tree using a pre-made indexed database - Use updatedb command to update the database used by
locate
- The output from
locate
may require using more or less commands to view - The
find
command recursively searches for files starting from a specified directory - Has format: find
-criteria . find
is slower but more versatile thanlocate
- Wildcard metacharacters must be quoted to be interpreted by
find
. - Specifying a subdirectory reduces search time
- The
PATH
variable lists directories where executable files are located, allowing them to be run without specifying the full path. - The
which
command searches for an executable file by searching thePATH
variable; if not found shows directories searched - The
type
andwhereis
commands are alternatives towhich
Linking Files
- Files can be linked to each other using symbolic links (symlinks).
- A symbolic link is a pointer or shortcut to another file
- Files can be linked to each other using hard links, where two files share the same data
- Improved understanding of file storage on a filesystem requires defining: superblock, inode tables, and data blocks.
- The superblock stores filesystem information like the number of inodes and data blocks, as well as the size of each data block
- The inode table contains inodes, each describing a file or directory with a unique inode number
- The inode stores file size, data block locations, last date modified, permissions, and ownership
- Data blocks contain the data making up the contents of a file and are referenced by the inode.
- Hard linked files share the same inode and inode number and must reside on the same filesystem
- To create a hard link, use the
ln
(link) command with two arguments: the existing file and the target file to be created as a hard link - Removing a hard linked file reduces the link count for the file
- Symbolic linked files do not share the same inode and data blocks with their target file
- A symbolic link is a pointer to its target, storing the pathname to the target file in its data blocks so editing the symbolic link edits the target file
- If the target file is deleted, the symbolic link become useless.
- To create a symbolic link, use the -s option with the
ln
command. - Symbolic links can use relative or absolute pathnames and are viewed with
ls -l
- Symbolic links need not reside on the same filesystem as their target
File and Directory Permissions
- Linux requires users to log in with a username and password.
- Usernames and group memberships determine access to resources based on required permissions.
File and Directory Ownership
- During file creation, the user's name and primary group become the owner and group owner
- The same applies for directory creation
whoami
command shows the current user namegroups
command shows group memberships and primary grouptouch
command creates an empty file.- The
chown
(change owner) command changes the ownership of a file or directory specified by two arguments, New owner, and file or directory to change - The
-R
option withchown
changes permissions recursively throughout the directory tree. chgrp
changes the group owner of a file or directory, using the same arguments and options aschown.
Managing File and Directory Permissions
- The mode is the inode section that stores permissions for the user (owner), group owner, and others (everyone)
- Read, write, and execute are the three regular permissions that may be assigned to each user
- The mode order is user, group, other.
- The system assigns the first set of permissions that are matched
- Focus on assigning permissions to the user and group, not just to "other"
Interpreting Permissions
- Read permission allows a user to open and read the file's contents
- Write permission allows a user to open, read, and edit file contents
- Execute permission allows a user to run the file in memory if it is a program or script
- Read permission on a directory lets a user list the contents when execute is granted
- Write permission on a directory lets a user add or remove files and requires execute
- Execute permission on a directory lets a user enter the directory and work with its contents
Changing Permissions
- The
chmod
(change mode) command changes the permissions (mode) of files or directories - The
chmod
command has at least two arguments, criteria used to change permissions and the filenames to change - When permissions are the same for all categories, use the "a" character to apply to all categories
- The values:
- u (user) - + (adds permission)
- g (group) - -(removes permission)
- o (other) - = (makes permission equal to)
- a (all categories)
- Permissions:
- r (read)
- w (write)
- x (execute)
- Numeric representation of the mode
- User, group, other
- Values for each, 4 read, 2 write, 1 execute
- The mode number is the sum of these values
Default Permissions
- New files have rw-rw-rw- permissions by default
- New directories have rwxrwxrwx permissions by default
- The umask variable is a special variable that takes away permissions on new files and directories.
umask
command is used to display the umask- To change the umask, set a new umask as an argument to the umask command.
Special Permissions
- These include SUID, SGID, and the sticky bit
Defining special permissions
- If SUID is set on a file, the user executing it gains ownership during execution (e.g., passwd command).
- SUID has no function on directories and only works on binary compiled programs, not shell scripts.
- SGID is applicable to both files and directories.
- If set on a file, the executing user becomes a member of the file's group.
- With SGID set on a directory, file creations in that directory are set to the directory's group owner, not the user's primary group
- The sticky bit was used to lock files in memory, but is currently limited to directories.
- It ensures users with write permissions can only delete their own files
Setting Special Permissions
- Special permissions require execute permissions
- They mask the execute permission when displayed with
Is –l
command - May be set even if file or directory does not have execute permission
- Indicating letter in the mode will be capitalized
- Special persmissions added via chmod command
Setting Custom Permissions in Access Control List (ACL)
- An ACL is a list of users or groups that you can assign permissions to
- The
setfacl
command is used to modify ACL entries for a Linux file or directory, using the-m
option - Use the
-b
option to remove all extra ACL assignments on a particular file or directory - The
getfacl
command lists all additional entries in the ACL
Managing Filesystem Attributes
- Linux files have settable attributes separate from Linux permissions
- These attributes are specific to the filesystem
- The
lsattr
command lists filesystem attributes - The
chattr
command adds or removes filesystem attributes. - The immutable attribute (i) prevents a files from being modified.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.