Chapter 8 File types in Linux.

” On a UNIX system, everything is a file, if something is not a file, it is a process. “Most of the files in linux , say regular files have normal data, eg some text files, executable files/programs, input and output to or from a program and so on.

File Types:-

Ordinary -> text, ./binary, .images, html and conf files
Directory -> Also known as folders
Special/Device File ->
Hardware Devices –> /dev/lp0 , /dev/hda1, /dev/sda1, /dev/fd0
Logical Devices –> /dev/null , /dev/zero
Links -  Hardlinks and SoftLinks + Difference of Hardlinks & SoftLinks
Sockets – A socket refers to a special file with which communication between locally running processes happens
FIFOs Or Named Pipes – act more or less like sockets and form a way for processes to communicate with each other, without using network socket semantics

FIFO is a one way communication pipe, while Unix domain sockets (otherwise called as IPC Sockets) are two way communication pipes

# ls -l  /dev/console
crw——- 1 root root 5, 1 2008-03-30 17:45 /dev/console

-    Regular file
d    Directory
l    Link
c    Special file
s    Socket
p    Named pipe

The maximum number of characters for a file name is 255
Use backslash for special characters
CaseSensiTivty for files : The Files in linux are case sensitive. File a and file A are two different files.

Color codes:-

blue    directories
red    compressed archives
white    text files
pink    images
cyan    links
yellow    devices
green    executables
flashing red    broken links

linux-file-permissions-ls-color

Suffix Schemes:-

nothing    regular file
/    directory
*    executable file
@    link
=    socket
|    named pipe

PathNames:-

Relative Path :- The relative path is the path to the destination file/directory from the current location (pwd). eg : cd ../var/www

Absolute path :- The relative path is the full path to the destination file/directory from the ‘/’. eg : vi /home/indisages/files
The maximum length of PathNames including slashes is  4096

Permissions:- The behavior of a file/directory to a particular user totally depends on the permission assigned to it.

rwx and octal/numerical representations
chmod
chgrp
umask for directories and files

Special Modes in Permission:-

Sticky bit – t, eg –> ls -ld /tmp
Set UID – When this mode is set on an executable file, it will run with the user and group permissions on the file instead of with those of the user issuing the command, thus giving access to system resources. eg : /usr/bin/passwd and /etc/passwd
Set GID – Same as SUID, but applies to group. eg : ls -l /usr/bin/write /usr/bin/bsd-write /dev/pts/1

Continue Reading


 

About this blog

This blog, acts as a knowledge repository for the world and is unofficial! Anything we find interesting in the cyber world will go here. Most cases, this blog will reflect the happiness of our staff in reaching successful solution to an issue (s)he worked on. A reference for other fellow SAGEs who come across similar issues later