What Is An Operating System?
Whenever we switch on our computer/laptop we get a screen where we can perform many activities like editing a document, browse the internet, play videos, install software, etc. But now we have a curiosity, how all these activities are supported by the electronic devices? How the processor of our device help us with the activities to be performed? It is the operating system which helps us to interact with the hardware.Operating System(OS) is what we need to work on our electronic device. As you are reading this on your electronic device you are utilizing the benefits of OS. Many of us have used many popular OS’s such as Windows, Apples OS, but here we will discuss the LINUX. What is LINUX
Linux is an operating system, it is just like Windows and Mac OS X. Operating system is a software that leverages hardware of the devices such as the laptop, desktop or tabs to the most. In a simple way, we can say the operating system is a bridge between the software and the hardware. Without OS it is not possible to run or execute software or program.
Advantages of Linux
Linux is an operating system, it is just like Windows and Mac OS X. Operating system is a software that leverages hardware of the devices such as the laptop, desktop or tabs to the most. In a simple way, we can say the operating system is a bridge between the software and the hardware. Without OS it is not possible to run or execute software or program.
Advantages of Linux
- Linux is free and can be downloaded from the internet, there is no hidden cost for registration, updates or anything.
- Linux is flexible i.e. Linux can be installed in any hardware, if a user is not sure what OS on his/her machine can be installed he can go with Linux.
- Linux is developed so that it can run all the time without rebooting, and because of this feature, many applications can be scheduled at calm hours.
- Security model implemented for Linux is based on the Unix, it is very secure against internet and other attacks as well.
- Linux can be customized as per requirement and bug fixes are very fast as it is open source and we can find many people available on the internet for solutions.
Disadvantages of Linux
- Linux is licensed under GNU Public License (GPL), which suggests anyone can change and distribute a changed version. So it is a bit confusing to find a suitable for our need version.
- Linux is not very user-friendly and it can be a bit confusing for the beginners.
Components of Linux:Linux architecture primarily has these components:Hardware,Kernel,Shell and and Utilities.
- Hardware: Peripheral devices such as RAM, HDD, CPU together constitute Hardware layer for the LINUX operating system.
- Kernel: The Core part of the Linux OS is called Kernel, it is responsible for many activities of the LINUX operating system. It interacts directly with hardware, which provides low-level services like providing hardware details to the system. We have two types of kernels – Monolithic Kernel and MicroKernel
- Shell: The shell is an interface between the user and the kernel, it hides the complexity of functions of the kernel from the user. It accepts commands from the user and performs the action.
- Utilities: Operating system functions are granted to the user from the Utilities. Individual and specialized functions are can be utilized from the System utilities.
Characteristics of Linux: Linux can be utilized using commands, which does the following functions:
- Linux commands are used to perform one or multiple tasks e.g. copy, paste, find, etc.
- Using commands tasks can be carried out efficiently and effectively for executing some program
Commands are supposed to be typed in a shell, this is like a communicator between us and the core Linux, which converts the human code to be executed by hardware. We can execute the code to find something in a file, as well as we can write code to execute the more complex codes like we can execute a command on the output of one command for this we need to use the “|” (pipe separator) between two or more commands. This i.e. pipe operator acts as a joint for the two commands. Below we have the examples of both single commands and the multiple commands joint using the pipe.
- grep – Search for a pattern in a file
- sort – Sort into order
- uniq – Only show one copy of identical things this is the examples of the single, this commands can work individually or we can utilize them to fetch something using all of them as one e.g. grep ARC *txt | sort | uniq > output.txt The above command will search all the files having the extension with ‘txt’ for the word “ARC” and it will save a copy of a record to a new file “output.txt”.
Different Shells in Linux
SHELL is a program which provides the interface between the user and an operating system. When the user logs in OS starts a shell for user. Kernel controls all essential computer operations, and provides the restriction to hardware access, coordinates all executing utilities, and manages Resources between process. Using kernel only user can access utilities provided by operating system. Shells have evolved with time; the first shell that came to the world was the Thompson shell which was written by ken Thompson at AT&T Bell Labs. It was distributed with Versions 1 through 6 of Unix, from 1971 to 1975. Soon, what we got was the Bourne shell which was developed by Stephen Bourne at Bell Labs, which was distributed as the shell for UNIX Version 7 in 1979. The Thompson shell was not a scripting shell and soon it was replaced by Bourne shell as which was accompanied by many improvements.. A shell is a program that provides an interface between a user and an operating system (OS) kernel. An OS starts a shell for each user when the user logs in or opens a terminal or console window..
A kernel is a program that:
- Controls all computer operations.
- Coordinates all executing utilities
- Ensures that executing utilities do not interfere with each other or consume all system resources.
- Schedules and manages all system processes.
Linux – Text processing commands:
- head -- display first lines of a file>>Display top 20 lines of a big text based file igfile.txte.txt
- tail -- display the last part of a file >>. Display 20 lines skipping 1st line (you may skip first row as it has headers) from a big file
- less – paged output, with support to move forward and backward>> Display a file with options to move backward/forward.
- cut -- cut out selected portions of each line of a file>> Cut the first column (read a compressed file, skip the header row, take next 10 rows and project the first field
- paste -- merge corresponding or subsequent lines of files>> Create a colon-separated list of directories named bin, suitable for use in the PATH environment variable:
- join -- relational database operator>> Find the extra data from first file which are not present in second file.
- awk -- pattern-directed scanning and processing language>> Print the first two fields from file (with tab separated fields) along with the row number and at the end print total rows.
- grep -- print lines matching a pattern>> Output the line which contain word ‘error’ or ‘warning’ from the log file.
- find -- display lines beginning with a given string>> List files with extension *.gz and greater than 1GB?
- wc -- word, line, character, and byte count>> Count number of processes currently running on a server
What is Shell Script :
A Shell Script is a text file that contains one or more commands. In a shell script, the shell assumes each line of text file holds a separate command. These Commands appear for most parts as if you have typed them in at a shell windows.
- Shell Keywords – if, else, break etc.
- Shell commands – cd, ls, echo, pwd, touch etc.
- Functions
- Control flow – if..then..else, case and shell loops etc Why do we need shell scripts
- There are many reasons to write shell scripts –
- To avoid repetitive work and automation
- System admins use shell scripting for routine backups
- System monitoring
- Adding new functionality to the shell etc.
A shell script comprises following elements –
SHELL SCRIPTING is writing a series of commands for the shell to execute. It can combine lengthy and repetitive sequences of commands into a single and simple script, which can be stored and executed anytime. This reduces the effort required by the end user.
Basic Features Linux Operating System:
Portable – Portability means softwares can works on different types of hardwares in same way.Linux kernel and application programs supports their installation on any kind of hardware platform.
Open Source – Linux source code is freely available and it is community based development project. Multiple teams works in collaboration to enhance the capability of Linux operating system and it is continuously evolving.
Multi-User – Linux is a multiuser system means multiple users can access system resources like memory/ ram/ application programs at same time.
Multiprogramming – Linux is a multiprogramming system means multiple applications can run at same time.
Hierarchical File System – Linux provides a standard file structure in which system files/ user files are arranged.
Shell – Linux provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, call application programs etc.
Security – Linux provides user security using authentication features like password protection/ controlled access to specific files/ encryption of data.
What is UNIX?
The UNIX OS was born in the late 1960s. AT&T Bell Labs released an operating system called Unix written in C, which allows quicker modification, acceptance, and portability. It began as a one-man project under the leadership of Ken Thompson of Bell Labs. It went on to become most widely used operating systems Unix is a proprietary operating system.The Unix OS works on CLI (Command Line Interface), but recently, there have been developments for GUI on Unix systems. Unix is an OS which is popular in companies, universities big enterprises, etc.
Features of Unix OS
- Multi-user, multitasking operating system
- It can be used as the master control program in workstations and servers.
- Hundreds of commercial applications are available
- In its heydays, UNIX was rapidly adopted and became the standard OS in universities.
Unix File System
Unix file system is a logical method of organizing and storing large amounts of information in a way that makes it easy to manage. A file is a smallest unit in which the information is stored. Unix file system has several important features. All data in Unix is organized into files. All files are organized into directories. These directories are organized into a tree-like structure called the file system.
Files in Unix System are organized into multi-level hierarchy structure known as a directory tree. At the very top of the file system is a directory called “root” which is represented by a “/”. All other files are “descendants” of root.
Directories or Files and their description –
- / : The slash / character alone denotes the root of the filesystem tree.
- /bin : Stands for “binaries” and contains certain fundamental utilities, such as ls or cp, which are generally needed by all users.
- /boot : Contains all the files that are required for successful booting process.
- /dev : Stands for “devices”. Contains file representations of peripheral devices and pseudo-devices.
- /etc : Contains system-wide configuration files and system databases. Originally also contained “dangerous maintenance utilities” such as init,but these have typically been moved to /sbin or elsewhere.
- /home : Contains the home directories for the users.
- /lib : Contains system libraries, and some critical files such as kernel modules or device drivers.
- /media : Default mount point for removable devices, such as USB sticks, media players, etc.
- /mnt : Stands for “mount”. Contains filesystem mount points. These are used, for example, if the system uses multiple hard disks or hard disk partitions. It is also often used for remote (network) filesystems, CD-ROM/DVD drives, and so on.
- /proc : procfs virtual filesystem showing information about processes as files.
- /root : The home directory for the superuser “root” – that is, the system administrator. This account’s home directory is usually on the initial filesystem, and hence not in /home (which may be a mount point for another filesystem) in case specific maintenance needs to be performed, during which other filesystems are not available. Such a case could occur, for example, if a hard disk drive suffers physical failures and cannot be properly mounted.
- /tmp : A place for temporary files. Many systems clear this directory upon startup; it might have tmpfs mounted atop it, in which case its contents do not survive a reboot, or it might be explicitly cleared by a startup script at boot time.
- /usr : Originally the directory holding user home directories,its use has changed. It now holds executables, libraries, and shared resources that are not system critical, like the X Window System, KDE, Perl, etc. However, on some Unix systems, some user accounts may still have a home directory that is a direct subdirectory of /usr, such as the default as in Minix. (on modern systems, these user accounts are often related to server or system use, and not directly used by a person).
- /usr/bin : This directory stores all binary programs distributed with the operating system not residing in /bin, /sbin or (rarely) /etc.
- /usr/include : Stores the development headers used throughout the system. Header files are mostly used by the #include directive in C/C++ programming language.
- /usr/lib : Stores the required libraries and data files for programs stored within /usr or elsewhere.
- /var : A short for “variable.” A place for files that may change often – especially in size, for example e-mail sent to users on the system, or process-ID lock files.
- /var/log : Contains system log files.
- /var/mail : The place where all the incoming mails are stored. Users (other than root) can access their own mail only. Often, this directory is a symbolic link to /var/spool/mail.
- /var/spool : Spool directory. Contains print jobs, mail spools and other queued tasks.
- /var/tmp : A place for temporary files which should be preserved between system reboots.
Types of Unix files – The UNIX files system contains several different types of files :
1. Ordinary files – An ordinary file is a file on the system that contains data, text, or program instructions.
- 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.
- In long-format output of ls -l, this type of file is specified by the “-” symbol.
2. Directories – Directories store both special and ordinary files. For users familiar with Windows or Mac OS, UNIX directories are equivalent to folders. A directory file contains an entry for every file and subdirectory that it houses. If you have 10 files in a directory, there will be 10 entries in the directory. Each entry has two components.
(1) The Filename
(2) A unique identification number for the file or directory (called the inode number)
- 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.
- When a character special file is used for device Input/Output(I/O), data is transferred one character at a time. This type of access is called raw device access.
- When a block special file is used for device Input/Output(I/O), data is transferred in large fixed-size blocks. This type of access is called block device access.
- In long-format output of ls -l, character special files are marked by the “c” symbol.
- In long-format output of ls -l, block special files are marked by the “b” symbol.
In long-format output of ls –l , this type of file is specified by the “d” symbol.
3. Special Files – Used to represent a real physical device such as a printer, tape drive or terminal, used for Input/Ouput (I/O) operations. Device or special files are used for device Input/Output(I/O) on UNIX and Linux systems. They appear in a file system just like an ordinary file or a directory.
On UNIX systems there are two flavors of special files for each device, character special files and block special files :
For terminal devices, it’s one character at a time. For disk devices though, raw access means reading or writing in whole chunks of data – blocks, which are native to your disk.
4. 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.A Unix pipe provides a one-way flow of data.The output or result of the first command sequence is used as the input to the second command sequence. To make a pipe, put a vertical bar (|) on the command line between two commands.For example: who | wc -l
In long-format output of ls –l , named pipes are marked by the “p” symbol.
5. Sockets – A Unix socket (or Inter-process communication socket) is a special file which allows for advanced inter-process communication. A Unix Socket is used in a client-server application framework. In essence, it is a stream of data, very similar to network stream (and network sockets), but all the transactions are local to the filesystem.
In long-format output of ls -l, Unix sockets are marked by “s” symbol.
6. Symbolic Link – Symbolic link is used for referencing some other file of the file system.Symbolic link is also known as Soft link. It contains a text form of the path to the file it references. To an end user, symbolic link will appear to have its own name, but when you try reading or writing data to this file, it will instead reference these operations to the file it points to. If we delete the soft link itself , the data file would still be there.If we delete the source file or move it to a different location, symbolic file will not function properly.
In long-format output of ls –l , Symbolic link are marked by the “l” symbol (that’s a lower case L).
No comments:
Post a Comment