File types In Linux/Unix
This is because Linux considers every thing as a
file. When ever you start working on Linux/Unix box you have to deal with
different file types(linux/unix) to effectively manage them
By default Unix have only 3 types of files. They
are..
1 Regular
files
2 Directory
files
3 Special
files(This category is having 5 sub types in it.)
- Regular Files
Used to store your information, such as some text
you have written or an image you have drawn. This is the type of file that you
usually work with.
Always located within/under a directory file
Do not contain other files
- Directories
Branching points in the hierarchical tree
Used to organize groups of files
May contain ordinary files, special files or other
directories
Never contain "real" information which you
would work with (such as text). Basically, just used for organizing files.
All files are descendants of the root directory, (
named / ) located at the top of the tree.
- Special Files
1 Block
file(b)
2 Character
device file(c)
3 Named
pipe file or just a pipe file(p)
4 Symbolic
link file(l)
5 Socket
file(s)
Used to represent a real physical device such as a
printer, tape drive or terminal, used for Input/Ouput (I/O) operations
Unix considers any device attached to the system to
be a file - including your terminal:
- By default, a command treats your terminal as the standard input file (stdin) from which to read its input
- Your terminal is also treated as the standard output file (stdout) to which a command's output is sent
- Stdin and stdout will be discussed in more detail later
Two types of I/O: character and block
Usually only found under directories named /dev
- Pipes
UNIX allows you to link commands together using a
pipe. The pipe acts a temporary file which only exists to hold data from one
command until it is read by another
For example, to pipe the output from one command
into another command:
who | wc
-l
This command will tell you how many users are
currently logged into the system. The standard output from the who command is a
list of all the users currently logged into the system. This output is piped
into the wc command as its standard input. Used with the -l option this command
counts the numbers of lines in the standard input and displays the result on
its standard output - your terminal.
Post a Comment