Filesystem Fundamentals Flashcards
What is a file
nothing more than a named sequence of
bytes stored on a permanent, non-volatile storage medium. It is entirely up to other software to
impose syntax and semantic meaning on a file’s sequence of bytes
what is a filesystem
an abstraction that allows the organization of files in a hierarchical structure.
consists of a root directory which may contain files, or more directories sometimes called sub-directories
Special Directory Names
Filename Extensions
Indicated by a period.
e.g .txt, .jpg
.c - C language source code files
.so - used by LINUX for compiled dynamic C libraries
In LINUX, an executable program
does not need to have a specific extension, nor does it need to have any extension at all
Filename and Pathname Rules and Properties
filename is limited to 255
characters.
A path name is limited to 4096 characters. these limits can be changed
file and directory names are case sensitive
LINUX System Directories
Basic Filesystem Commands
Operations on Multiple Files
Filename Globbing (Wildcard Filenames)
File globs are patterns
specified with wildcard characters.
file globbing is a feature of the shell and cannot generally be used elsewhere, such as within another application, unless that application also supports some form
of file globbing.
- character matches any number of characters of any kind, including no characters at all.For example, the file glob *.jpg matches any file that has a .jpg extension, regardless of howmany characters are before the extension.
? character matches any single character. For example, the file glob quest?.txt matches
all of quest1.txt, questX, and questj.txt.
A list of characters inside a pair of square brackets matches any one of the listed characters.
For example, the glob quest[12345].txt would match quest1.txt and quest4.txt but not
quest8.txt or questX.txt
Access Permission Categories
every file and directory has an owner,group and at times other
owner of a file is a user ID
group of the file is the ID of a file group
A file group has: groupID and every usrID is either a member of that group or not
other is a userID that is not the owner nor a member of the file’s group
each category has read,write,execute; each denoted by 3 letter.
- indicates that the category doesn’t have access to this.
Permissions for Files
read permission allows the file to be opened for reading only
write permission allows the file to be opened for writing only,Write permission does not imply read permission
execute permission allows the file to be executed if the file is a compiled C program, a shell script, or another executable file format
If a file with the execute permission is not an
executable file type, it will try executing it anyway, but the operating system will issue an error
Permissions for Directories
read permission grants the ability to read what files are in the directory, but revoking this
permission does not necessarily prevent reading a file in that directory if you know it’s name
write permission grants the ability to create or remove files in/from a directory
execute permission grants the ability to use the directory in a pathname and set the directory
to be the current working directory using cd. If you do not have execute permission on a directory,
you cannot access anything in subdirectories of that directory.
Displaying File Permissions
ls -l
displays persmission, then a number, then file owner,file group,file size,date/time
the permissions of a parent directory could override file access. For example,
if the parent directory of the shown listing denies read and execute permission to other, the read permissions granted to other on a.out and test.c are irrelevant, and access would be denied
Changing Ownership
changes the owner of a file or directory. The syntax
is:
chown <newowner> <path1> ...</path1></newowner>
newowner> is the user ID you wish to change the owner to,
<path1> ... is/are one or more path(s) to the file(s) or directory(ies) you wish to change the owner of
</path1>
Changing the File Group
chgrp <newgroup> <path1> ...</path1></newgroup>
<newgroup> is the new file group ID you wish to assign,
</newgroup>