Understanding Linux file Types Flashcards
what does POSIX stand for?
POSIX = Portable Operation System Interface
How many file types does the POSIX standard define?
7
Which are the file types?
Regular
Directory
Sym link
FIFO
Block
Character
Socket
What is the command to see a file’s type?
file
what defines a file’s type?
what defines a file’s type is its magic number in the header and the #file command interprets this #
How can you identify a regular file?
Regular files: denoted by a hypen - in ls -l
What do regular files have?
they have a file name pointing to an inode which in turn points to a data block
Can a regular file contain another file or directory?
No
How can you identify a directory?
they are denoted by a d - in ls -l
What do directories have within?
They have entries to other directories (sub dir) and other regular files
Can hard links be a directory?
No
Hard links are limited to the same what?
Hard links must be in the same inode table, meaning the same File system
What do hard links have?
they have a file name pointing to an inode which in turn points to a data block, same as a regular file
How can you identify a sym link?
in the output of ls -l, you will see a lowecase L
For who can you create sym links?
Sym links can be created for files and directories as well
Can sym links cross FS?
yes
what does a sym link do?
they are a full path reference to another file o directory
what perms do sym links have?
they have 777 perms
what does FIFO mean?
FIFO pipe (first in - first out pipe)
How can you identify a FIFO?
denoted by a p in the o/p of ls -l
what command creates a FIFO file?
mkfifo
What is an unamed pipe?
Unnamed pipes: such as ls -l | wc -l
they are a one-way communication between commands and you can pipe as many as you want/needed
What is a named pipe?
so you can take a command and send its output to a pipe file, and then use that pipe file contents as stdin of another command
command to create a file that will work as a pipe is #mkfifo
What is a socket for?
they are for bi-directional communication between local or remote systems