Main File Structure


About Linux Features

Multi-user: Many users can share the same data at the same time.

Multitask: Many applications can run at the same time on background and foreground.

Multi-terminal: By default, there are seven different terminals in Linux. One is Graphics User Interface (GUI) and six are Character User Interface (CUI).

Note, Alt+Ctrl+(F1-F6) for CUI and Alt+Ctrl+F7 for GUI.

Security: Linux is one of the great secure OS. Any ordinary users can’t share other user’s home directory, if root or owner of home directory doesn’t give the permission to him/her to access. The Linux security model, file security and process security are explained below briefly to get a preliminary concept on Linux security.

The Linux security Model:

Ø Users and groups are used to control access to files and resources.

Ø Users log in to the system by supplying their users name and password.

Ø Every file on the system is owned by a user and associated with a group.

Ø Every process has an owner and group affiliation and can only access the resources its owner or group can access.

Linux File Security:

Ø Every file and directory has permissions set that determine who can access it.

Ø Permissions are set for:

o The owner of the file.

o The group members.

o All others.

Ø Permissions that are set are called read, write and execute permissions.

Linux Process Security:

Ø When a process accesses a file the user and group of the process are compared with the user and group of the file.

o If the user matches the user permissions apply.

o If the group matches, but the user doesn’t the group permissions apply.

o If neither matches, the other permissions apply.

Examining permissions:

Example: ls –l or ll

Ø File type and file access permissions are symbolized by a 10 characters string.

Ø User categories:

U, g, o - User, Group, Others.

Bugs: Bugs is nothing but as virus. Virus can’t destroy any file in Linux. But some type of bugs can create problems to execute a command or to share or access a file.

Firewall: Firewall is great security system in Linux. It is like a gate security guard to check signal which coming from other system through network.

Communication: It can communicate through Internet or network.

Portable: There is no a hardly requirement for any kind of hardware architecture to run the Linux operating system.

Types of users

Super User: super user is a root user is a special administrative account and has a complete control over the system that means an unlimited capability to damage the system. In the shell command prompt, the symbol for root is ‘#’.

Example: [root@localhost root]#

Note: You should not log in as root without a very good reason.

Normal User or ordinary User: Normal (“Unprivileged”) user’s potential to do damage is limited. These users usually are created by super user. In the shell command prompt, the symbol for ordinary user is ‘$’.

Example: [mick@localhost mick]$

Architecture of Linux (Red Hat)

Kernel: kernel is the OS. It is the interface between shell and hardware. All the important task of the Linux operating system is done by kernel, so it is called the operating system. The main tasks of kernel are given below.

a) File Management.

b) Memory Management.

c) CPU Scheduling.

Shell: There are many different kinds of shell. Ex. Bash shell, Korn shell, C shell, Tsch shell etc. But in Linux, normally Bash (Bourne Again SHell) shell is used.

Tools and Applications:

Hardware:

The Seven Fundamental File System

1) - Regular File

2) d Directory File

3) l Symbolic Link

4) b Block Special File

5) c Character Special File

6) p Named Pipe

7) s Socket

Example of Named Pipe: a file that passed data between processors. It stors no data itself, but passes data between one process writing data into the named pipe and another process reading data from the named pipe. A named pipe can be created using the mknod command.

$ mknod mypipe p

Socket: a stylized mechanism for interprocess communication. It is extremely rare for a user or even a system administrator to explicitly create a socket.

File Structure

Directory

Contained Data

bin

All binary files.

sbin

All system binary files.

dev

All device files.

boot

All bootable system files.

etc

All configuration files.

mnt

Mounting point for cdrom and floppy.

root

Administrator’s home directory.

home

All ordinary user’s home directory.

usr

tmp

tmp means temporary, all the temporary files are stored in this directory. By default this directory always be empty. That means when the computer’s power is off, the tmp directory is empty.

opt

It means optional directory. Root or other users can use this directory for optional task. Some times it used for mount pointing purpose.

proc

The proc is called the virtual directory. All the information of hardware and running process are stored in this directory after starting the computer. The kernel creates those files. Computer’s off time, it is empty directory.

lib

var

All the login information is stored in the directory.

lost+found

If any files are missed from the above directories then those files shell be stored in the lost+found directory.

PTAH Types

There are two kinds of path type,

1. Absolute path: Which path is starting from foreword slash is called absolute path name. Example: /etc/sysconfig.

2. Relative path: Which path is starting from normal directory name is called Relative path name. Example: etc/sysconfig.

Directory and inodes

The human way to reference a file or directory is by file name but the computer’s reference for a file or directory is the inode number. A directory is a mapping between computer’s inode numbers.

An inode table contains a list of all files in an ext2 or ext3 file system. It (index nodes) is an entry in the table, containing information about a file (the metadata) including: file type, permissions, link count, UID, GID, the file’s size and various time stamps, pointers to the file’s data blocks on disk, other data about the file.

Example,

[root@localhost root]# ls -il

[root@localhost root]# ls -il

To the below we give some examples and what will be occurred when we use cp, mv and rm commands to copy, move and remove a file respectively.

cp and inodes:

When we execute the cp command to copy some thing (file, directory) to a specific place then the following steps are occurred:

1. Allocates a free inode number, placing a new entry in the inode table.

2. Creates a directory entry, referencing the files, human file name to the inode number.

3. Copies data into the new file.

Example,

[root@localhost root]# ls -li myfile

[root@localhost root]# cp myfile mewfile

[root@localhost root]# ls -li myfile newfile

mv and inodes:

If the destination of the mv command is on the same file system as the source the mv command.

1. Creates a new directory entry with the new file name.

2. Deletes the old directory entry with old file name.

3. Has no impact on the inode table (except for a time stamp) or the location of data on the disk: no data is moved.

Example,

[root@localhost root]# ls -li tux

[root@localhost root]# mv tux fedora

[root@localhost root]# ls -li fedora

rm and inodes:

For the rm command, the following steps are occurred to maintain the inode number,

1. Decrements the link count, thus freeing the inode number to be reused.

2. Places data blocks on the free list.

3. Removed the directory entry.

4. Data is not actually removed, but will be overwritten when the data blocks are used by another file.