0% found this document useful (0 votes)
78 views

UNIT III Operating System

The document discusses operating systems and their functions. It defines an operating system as software that manages computer hardware resources and provides common services for programs. It then discusses examples of popular operating systems like Windows, Linux, MacOS, iOS, and Android. It outlines several key functions of an operating system, including process management, I/O device management, file management, memory management, and secondary storage management. It provides details on how operating systems perform tasks like creating and terminating processes, mapping files to storage, and allocating memory space.

Uploaded by

pachchu31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

UNIT III Operating System

The document discusses operating systems and their functions. It defines an operating system as software that manages computer hardware resources and provides common services for programs. It then discusses examples of popular operating systems like Windows, Linux, MacOS, iOS, and Android. It outlines several key functions of an operating system, including process management, I/O device management, file management, memory management, and secondary storage management. It provides details on how operating systems perform tasks like creating and terminating processes, mapping files to storage, and allocating memory space.

Uploaded by

pachchu31
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

SMRSISM Operating System

Operating System

An Operating System (OS) is a collection of software that manages computer hardware resources
and provides common services for computer programs. When you start using a Computer System
then it's the Operating System (OS) which acts as an interface between user and the computer
hardware. The operating system is really a low level Software which is categorised as a System
Software and supports a computer's basic functions, such as memory management, tasks scheduling
and controlling peripherals etc.

What is Operating System?

An Operating System (OS) is an interface between a computer user and computer hardware. An
operating system is a software which performs all the basic tasks like file management, memory
management, process management, handling input and output, and controlling peripheral devices
such as disk drives and printers.

Generally, a Computer System consists of the following components:

• Computer Users are the users who use the overall computer system.

• Application Softwares are the softwares which users use directly to perform different
activities. These softwares are simple and easy to use like Browsers, Word, Excel, different
Editors, Games etc. These are usually written in high-level languages, such as Python, Java
and C++.

• System Softwares are the softwares which are more complex in nature and they are more
near to computer hardware. These software are usually written in low-level languages like
assembly language and includes Operating Systems (Microsoft Windows, macOS, and Linux),
Compiler, and Assembler etc.

• Computer Hardware includes Monitor, Keyboard, CPU, Disks, Memory, etc.

Operating System - Examples

There are plenty of Operating Systems available in the market which include paid and unpaid (Open
Source). Following are the examples of the few most popular Operating Systems:

• Windows: This is one of the most popular and commercial operating systems developed and
marketed by Microsoft. It has different versions in the market like Windows 8, Windows 10
etc and most of them are paid.

• Linux This is a Unix based and the most loved operating system first released on September
17, 1991 by Linus Torvalds. Today, it has 30+ variants available like Fedora, CentOS, UBuntu
etc. Most of them are available free of charges though you can have their enterprise
versions by paying a nominal license fee.

• MacOS This is again a kind of Unix operating system developed and marketed by Apple Inc.
since 2001.

• iOS ( iPhone Operating System)This is a mobile operating system created and developed by


Apple Inc. exclusively for its mobile devices like iPhone and iPad etc.

PRASHANTH C PATEL 1
SMRSISM Operating System

• Android This is a mobile Operating System based on a modified version of the Linux kernel
and other open source software, designed primarily for touchscreen mobile devices such as
smartphones and tablets.

Some other old but popular Operating Systems include Solaris, VMS, OS/400, AIX, z/OS, etc.

Operating System - Functions

To brief, Following are some of important functions of an operating System which we will look in
more detail in upcoming chapters:

• Process Management

• I/O Device Management

• File Management

• Network Management

• Main Memory Management

• Secondary Storage Management

• Security Management

• Command Interpreter System

• Control over system performance

• Job Accounting

• Error Detection and Correction

• Coordination between other software and users

• Many more other important tasks

Process Management

A process is program or a fraction of a program that is loaded in main memory. A process needs
certain resources including CPU time, Memory, Files, and I/O devices to accomplish its task. The
process management component manages the multiple processes running simultaneously on the
Operating System.

A program in running state is called a process.

The operating system is responsible for the following activities in connection with process
management:

• Create, load, execute, suspend, resume, and terminate processes.

• Switch system among multiple processes in main memory.

• Provides communication mechanisms so that processes can communicate with each others

• Provides synchronization mechanisms to control concurrent access to shared data to keep


shared data consistent.

• Allocate/de-allocate resources properly to prevent or avoid deadlock situation.

PRASHANTH C PATEL 2
SMRSISM Operating System

I/O Device Management

One of the purposes of an operating system is to hide the peculiarities of specific hardware devices
from the user. I/O Device Management provides an abstract level of H/W devices and keep the
details from applications to ensure proper use of devices, to prevent errors, and to provide users
with convenient and efficient programming environment.

Following are the tasks of I/O Device Management component:

• Hide the details of H/W devices

• Manage main memory for the devices using cache and buffer.

• Maintain and provide custom drivers for each device.

File Management

File management is one of the most visible services of an operating system. Computers can store
information in several different physical forms; magnetic tape, disk, and drum are the most common
forms.

A file is defined as a set of correlated information and it is defined by the creator of the file. Mostly
files represent data, source and object forms, and programs. Data files can be of any type like
alphabetic, numeric, and alphanumeric.

A files is a sequence of bits, bytes, lines or records whose meaning is defined by its creator and user.

The operating system implements the abstract concept of the file by managing mass storage device,
such as types and disks. Also files are normally organized into directories to ease their use. These
directories may contain files and other directories and so on.

The operating system is responsible for the following activities in connection with file management:

• File creation and deletion

• Directory creation and deletion

• The support of primitives for manipulating files and directories

• Mapping files onto secondary storage

• File backup on stable (nonvolatile) storage media

Network Management

The definition of network management is often broad, as network management involves several
different components. Network management is the process of managing and administering a
computer network. A computer network is a collection of various types of computers connected
with each other.

Network management comprises fault analysis, maintaining the quality of service, provisioning of
networks, and performance management.

Network management is the process of keeping your network healthy for an efficient
communication between different computers.

Following are the features of network management:

PRASHANTH C PATEL 3
SMRSISM Operating System

• Network administration

• Network maintenance

• Network operation

• Network provisioning

• Network security

Main Memory Management

Memory is a large array of words or bytes, each with its own address. It is a repository of quickly
accessible data shared by the CPU and I/O devices.

Main memory is a volatile storage device which means it loses its contents in the case of system
failure or as soon as system power goes down.

The main motivation behind Memory Management is to maximize memory utilization on the
computer system.

The operating system is responsible for the following activities in connections with memory
management:

• Keep track of which parts of memory are currently being used and by whom.

• Decide which processes to load when memory space becomes available.

• Allocate and deallocate memory space as needed.

Secondary Storage Management

The main purpose of a computer system is to execute programs. These programs, together with
the data they access, must be in main memory during execution. Since the main memory is too
small to permanently accommodate all data and program, the computer system must provide
secondary storage to backup main memory.

Most modern computer systems use disks as the principle on-line storage medium, for both
programs and data. Most programs, like compilers, assemblers, sort routines, editors, formatters,
and so on, are stored on the disk until loaded into memory, and then use the disk as both the
source and destination of their processing.

The operating system is responsible for the following activities in connection with disk
management:

• Free space management

• Storage allocation

• Disk scheduling

Types of Operating Systems

Batch Operating System

PRASHANTH C PATEL 4
SMRSISM Operating System

In the 1970s, Batch processing was very popular. In this technique, similar types of jobs were
batched together and executed in time. People were used to having a single computer which was
called a mainframe.

In Batch operating system, access is given to more than one person; they submit their respective
jobs to the system for the execution. The system put all of the jobs in a queue on the basis of first
come first serve and then executes the jobs one by one. The users collect their respective output
when all the jobs get executed.

Multiprogramming Operating System

Multiprogramming is an extension to batch processing where the CPU is always kept busy. Each
process needs two types of system time: CPU time and IO time.

In a multiprogramming environment, when a process does its I/O, The CPU can start the execution of
other processes. Therefore, multiprogramming improves the efficiency of the system.

Multiprocessing Operating System

In Multiprocessing, Parallel computing is achieved. There are more than one processor present in
the system which can execute more than one process at the same time. This will increase the
throughput of the system.

Multitasking Operating System

The multitasking operating system is a logical extension of a multiprogramming system that


enables multiple programs simultaneously. It allows a user to perform more than one computer task
at the same time.

PRASHANTH C PATEL 5
SMRSISM Operating System

Network Operating System

An Operating system, which includes software and associated protocols to communicate with other
computers via a network conveniently and cost-effectively, is called Network Operating System.

Real Time Operating System

In Real-Time Systems, each job carries a certain deadline within which the job is supposed to be
completed, otherwise, the huge loss will be there, or even if the result is produced, it will be
completely useless.

The Application of a Real-Time system exists in the case of military applications, if you want to drop
a missile, then the missile is supposed to be dropped with a certain precision.

PRASHANTH C PATEL 6
SMRSISM Operating System

Time-Sharing Operating System

In the Time Sharing operating system, computer resources are allocated in a time-dependent fashion
to several programs simultaneously. Thus it helps to provide a large number of user's direct access
to the main computer. It is a logical extension of multiprogramming. In time-sharing, the CPU is
switched among multiple programs given by different users on a scheduled basis.

A time-sharing operating system allows many users to be served simultaneously, so sophisticated


CPU scheduling schemes and Input/output management are required.

Time-sharing operating systems are very difficult and expensive to build.

Distributed Operating System

A distributed operating system (DOS) is an essential type of operating system. Distributed systems


use many central processors to serve multiple real-time applications and users. As a result, data
processing jobs are distributed between the processors.

PRASHANTH C PATEL 7
SMRSISM Operating System

It connects multiple computers via a single communication channel. Each of these systems has its
own processor and memory. Additionally, these CPUs communicate via high-speed buses or
telephone lines. Individual systems that communicate via a single channel are regarded as a single
entity.

Single User Operating System

A single-user operating system is a type of operating system developed and intended for use on a
computer or similar machine that will only have a single user at any given time. This type of OS is
typically used on devices like wireless phones and two-way messaging devices.

The operating system is responsible for handling many different tasks and is typically one of the
most important programs used on a computer. It manages memory usage and other resources,
hardware connectivity and the proper execution of other applications. A single task operating
system can only run one program or application at a time. So it is not as useful for a computer or
other device intended to run multiple programs at once.

System Software /System Program

These are the software that directly allows the user to interact with the hardware components of a
computer system. As the humans and machines follow different languages, there has to be an
interface that will allow the users to interact with the core system, this interface is provided by the
software. The system software can be called the main software of a computer system as it handles
the major portion of running a hardware. This System Software can be further divided into four
major types:

PRASHANTH C PATEL 8
SMRSISM Operating System

The Operating System – It is the main program that governs and maintains the inter-cooperation of
the components of a computer system. For eg., Microsoft Windows, Linux, Mac OS etc.

• The Language Processor – The hardware components present in the computer system does
not understand human language. There are three types of languages involved in the world of
human-machine interaction:

• Machine-Level Language: The machines only understand the digital signals or the binary
codes or the binary language which consist of strings of 0’s and 1’s. These are totally
machine dependent language.

• Assembly-Level Language: These are the Low-Level Language(LLL), that forms a


correspondence between machine level instruction and general assembly level statements.
Assembly language uses a mnemonics to represent each low-level machine instruction or
operation-code also called the op-codes. For eg., ADD instruction is used to add two entities,
the HALT instruction is used to stop a process etc. It is a machine dependent language and
varies from processor to processor.

• High-Level Language: These are the simple English statements, that humans use to program
and code as it is easy to read and understand to the human world. For eg., Java, C, C++,
Python etc.

The machine level language is very complex to understand and code, therefore the users prefer
the High-Level Language  or the HLL for coding. These codes need to be converted into the machine
language so that the computer can easily understand and work accordingly. This operation is
performed by the Language Processor which is made up of further three components:

• Assembler: This language processor is used to convert the assembly language into machine
level language.

• Compiler: This language processor is used to convert High-Level Language into machine level
language in one go, thus execution time is fast. The error detection is difficult in a compiler.
Programming Languages like C, C++ and Scala use compiler.

• Interpreter: This language processor is also used to convert High-Level Language into


machine level language line-by-line, thus execution time is slow. Error-detection is easier in
an interpreter as it reports as soon as a bug is caught and restarts the process. This
consumes unnecessary memory. Programming Languages like Python, Ruby and Java uses an
interpreter.

• The Device Drivers – The device drivers and the device programs or the system software
that acts as an interface between the various Input-Output device and the users or the
operating system. For eg., the Printers, Web cameras come with a driver disk that is needed
to be installed into the system to make the device run in the system.

• The BIOS – It stands for Basic Input Output System and is a small firmware, that controls the
peripheral or the input-output devices attached to the system. This software is also
responsible for starting the OS or initiating the booting process.

Application Software

PRASHANTH C PATEL 9
SMRSISM Operating System

These are the basic software used to run to accomplish a particular action and task. These are the
dedicated software, dedicated to performing simple and single tasks. For eg., a single software
cannot serve to both the reservation system and banking system. These are divided into two types:

1. The General Purpose Application Software: These are the types of application software that
comes in-built and ready to use, manufactured by some company or someone. For eg.,

1. Microsoft Excel – Used to prepare excel sheets.

2. VLC Media Player  – Used to play audio/video files.

3. Adobe Photoshop  – Used for designing and animation and many more.

2. The Specific Purpose Application Software: These are the type of software that is
customizable and mostly used in real-time or business environment. For eg.,

1. Ticket Reservation System


2. Healthcare Management System
3. Hotel Management System
4. Payroll Management System

Utility Software
These are the most basic type of software which provides high utility to the user and the system.
These perform the basic but daily need tasks. For eg.,
• Antivirus Softwares: These provide protection to the computer system from unwanted
malware and viruses. For eg., QuickHeal, McAfee etc.
• Disk Defragmenter Tools: These help the users to analyse the bad sectors of the disk and
rearrange the files in a proper order.
• Text-editors: These help the users to take regular notes and create basic text files. For eg.,
Notepad, Gedit etc.

UNIX operating system


UNIX is a powerful Operating System initially developed by Ken Thompson, Dennis
Ritchie at AT&T Bell laboratories in 1970. It is prevalent among scientific,
engineering, and academic institutions due to its most appreciative features like
multitasking, flexibility, and many more. In UNIX, the file system is a hierarchical
structure of files and directories where users can store and retrieve information using
the files.

1
PRASHANTH C PATEL
0
SMRSISM Operating System

Multitasking: A UNIX operating system is a multitasking operating system that


allows you to initiate more than one task from the same terminal so that one task is
performed as a foreground and the other task as a background process.

Multi-user: UNIX operating system supports more than one user to access computer
resources like main memory, hard disk, tape drives, etc. Multiple users can log on to
the system from different terminals and run different jobs that share the resources of
a command terminal. It deals with the principle of time-sharing. Time-sharing is done
by a scheduler that divides the CPU time into several segments also called a time
slice, and each segment is assigned to each user on a scheduled basis. This time slice
is tiny. When this time is expired, it passes control to the following user on the
system. Each user executes their set of instructions within their time slice.

Portability: This feature makes the UNIX work on different machines and platforms with the
easy transfer of code to any computer system. Since a significant portion of UNIX is written
in C language, and only a tiny portion is coded in assembly language for specific hardware.

File Security and Protection: Being a multi-user system, UNIX makes special


consideration for file and system security. UNIX has different levels of security using
assigning username and password to individual users ensuring the authentication, at
the level providing file access permission viz. read, write and execute and lastly file
encryption to change the file into an unreadable format.

1
PRASHANTH C PATEL
1
SMRSISM Operating System

Command Structure: UNIX commands are easy to understand and simple to use.


Example: "cp", mv etc. While working in the UNIX environment, the UNIX commands
are case-sensitive and are entered in lower case.

Communication: In UNIX, communication is an excellent feature that enables the


user to communicate worldwide. It supports various communication facilities
provided using the write command, mail command, talk command, etc.

Open Source: UNIX operating system is open source it means it is freely available to


all and is a community-based development project.

Accounting: UNIX keeps an account of jobs created by the user. This feature


enhances the system performance in terms of CPU monitoring and disk space
checking. It allows you to keep an account of disk space used by each user, and the
disk space can be limited by each other. You can assign every user a different disk
quota. The root user can perform these accounting tasks using various commands
such as quota, df, du, etc.

UNIX Tools and Utilities: UNIX system provides various types of tools and utilities
facilities such as UNIX grep, sed and awk, etc. Some of the general-purpose tools are
compilers, interpreters, network applications, etc. It also includes various server
programs which provide remote and administration services.

1
PRASHANTH C PATEL
2
SMRSISM Operating System

The structure of Unix OS Layers are as follows:

Layer-1: Hardware -
This layer of UNIX consists of all hardware-related information in the UNIX
environment.

Layer-2: Kernel -
The core of the operating system that's liable for maintaining the full functionality is
named the kernel. The kernel of UNIX runs on the particular machine hardware and
interacts with the hardware effectively.

It also works as a device manager and performs valuable functions for the processes
which require access to the peripheral devices connected to the computer. The
kernel controls these devices through device drivers.

The kernel also manages the memory. Processes are executed programs that have
owner's humans or systems who initiate their execution.

1
PRASHANTH C PATEL
3
SMRSISM Operating System

Layer-3: The Shell -


The Shell is an interpreter that interprets the command submitted by the user at the
terminal, and calls the program you simply want.

It also keeps a history of the list of the commands you have typed in. If you need to
repeat a command you typed it, use the cursor keys to scroll up and down the list or
type history for a list of previous commands. There are various commands like cat,
mv, cat, grep, id, wc, and many more.

o Bourne Shell: This Shell is simply called the Shell. It was the first Shell for
UNIX OS. It is still the most widely available Shell on a UNIX system.
o C Shell: The C shell is another popular shell commonly available on a UNIX
system. The C shell was developed by the University of California at Berkeley
and removed some of the shortcomings of the Bourne shell.
o Korn Shell: This Shell was created by David Korn to address the Bourne Shell's
user-interaction issues and to deal with the shortcomings of the C shell's
scripting quirks.

Layer-4: Application Programs Layer -


It is the outermost layer that executes the given external applications. UNIX
distributions typically come with several useful applications programs as
standard. For Example: emacs editor, StarOffice, xv image viewer, g++ compiler etc

UNIX operating system


UNIX is a powerful Operating System initially developed by Ken Thompson, Dennis
Ritchie at AT&T Bell laboratories in 1970. It is prevalent among scientific,
engineering, and academic institutions due to its most appreciative features like
multitasking, flexibility, and many more. In UNIX, the file system is a hierarchical
structure of files and directories where users can store and retrieve information using
the files.

1
PRASHANTH C PATEL
4
SMRSISM Operating System

Multitasking: A UNIX operating system is a multitasking operating system that


allows you to initiate more than one task from the same terminal so that one task is
performed as a foreground and the other task as a background process.

Multi-user: UNIX operating system supports more than one user to access computer
resources like main memory, hard disk, tape drives, etc. Multiple users can log on to
the system from different terminals and run different jobs that share the resources of
a command terminal. It deals with the principle of time-sharing. Time-sharing is done
by a scheduler that divides the CPU time into several segments also called a time
slice, and each segment is assigned to each user on a scheduled basis. This time slice
is tiny. When this time is expired, it passes control to the following user on the
system. Each user executes their set of instructions within their time slice.

Portability: This feature makes the UNIX work on different machines and platforms with the
easy transfer of code to any computer system. Since a significant portion of UNIX is written
in C language, and only a tiny portion is coded in assembly language for specific hardware.

File Security and Protection: Being a multi-user system, UNIX makes special


consideration for file and system security. UNIX has different levels of security using
assigning username and password to individual users ensuring the authentication, at
the level providing file access permission viz. read, write and execute and lastly file
encryption to change the file into an unreadable format.

1
PRASHANTH C PATEL
5
SMRSISM Operating System

Command Structure: UNIX commands are easy to understand and simple to use.


Example: "cp", mv etc. While working in the UNIX environment, the UNIX commands
are case-sensitive and are entered in lower case.

Communication: In UNIX, communication is an excellent feature that enables the


user to communicate worldwide. It supports various communication facilities
provided using the write command, mail command, talk command, etc.

Open Source: UNIX operating system is open source it means it is freely available to


all and is a community-based development project.

Accounting: UNIX keeps an account of jobs created by the user. This feature


enhances the system performance in terms of CPU monitoring and disk space
checking. It allows you to keep an account of disk space used by each user, and the
disk space can be limited by each other. You can assign every user a different disk
quota. The root user can perform these accounting tasks using various commands
such as quota, df, du, etc.

UNIX Tools and Utilities: UNIX system provides various types of tools and utilities
facilities such as UNIX grep, sed and awk, etc. Some of the general-purpose tools are
compilers, interpreters, network applications, etc. It also includes various server
programs which provide remote and administration services.

1
PRASHANTH C PATEL
6
SMRSISM Operating System

The structure of Unix OS Layers are as follows:

Layer-1: Hardware -
This layer of UNIX consists of all hardware-related information in the UNIX
environment.

Layer-2: Kernel -
The core of the operating system that's liable for maintaining the full functionality is
named the kernel. The kernel of UNIX runs on the particular machine hardware and
interacts with the hardware effectively.

It also works as a device manager and performs valuable functions for the processes
which require access to the peripheral devices connected to the computer. The
kernel controls these devices through device drivers.

The kernel also manages the memory. Processes are executed programs that have
owner's humans or systems who initiate their execution.

1
PRASHANTH C PATEL
7
SMRSISM Operating System

Layer-3: The Shell -


The Shell is an interpreter that interprets the command submitted by the user at the
terminal, and calls the program you simply want.

It also keeps a history of the list of the commands you have typed in. If you need to
repeat a command you typed it, use the cursor keys to scroll up and down the list or
type history for a list of previous commands. There are various commands like cat,
mv, cat, grep, id, wc, and many more.

o Bourne Shell: This Shell is simply called the Shell. It was the first Shell for
UNIX OS. It is still the most widely available Shell on a UNIX system.
o C Shell: The C shell is another popular shell commonly available on a UNIX
system. The C shell was developed by the University of California at Berkeley
and removed some of the shortcomings of the Bourne shell.
o Korn Shell: This Shell was created by David Korn to address the Bourne Shell's
user-interaction issues and to deal with the shortcomings of the C shell's
scripting quirks.

Layer-4: Application Programs Layer -


It is the outermost layer that executes the given external applications. UNIX
distributions typically come with several useful applications programs as
standard. For Example: emacs editor, StarOffice, xv image viewer, g++ compiler etc

Basic Unix Commands


Getting help in Unix

 man – view manual pages for Unix commands


Syntax:
system22@VirtualBox: ~$ man

Unix Shell Commands

1
PRASHANTH C PATEL
8
SMRSISM Operating System

 clear – clear screen


Syntax:
system22@VirtualBox: ~$ clear

 history – show history of previous commands


Syntax:
system22@VirtualBox: ~$ history

Time and Date commands

 date – show current date and time


Syntax:

system22@VirtualBox: ~$ time
system22@VirtualBox: ~$ date

 sleep – wait for a given number of seconds


Syntax:
system22@VirtualBox: ~$ sleep

 uptime – find out how long the system has been up


Syntax:
system22@VirtualBox: ~$ uptime

Unix users commands


These commands allow you to get basic information about Unix users in your
environment.
 whoami – show your username
Syntax:
system22@VirtualBox: ~$whoami

 id – print user identity


Syntax:
system22@VirtualBox: ~$id
 groups – show which groups user belongs to
Syntax:
system22@VirtualBox: ~$ groups
 passwd – change user password
Syntax:
system22@VirtualBox: ~$ passwd
 who – find out who is logged into the system
Syntax:
system22@VirtualBox: ~$ who
 last – show history of logins into the system
1
PRASHANTH C PATEL
9
SMRSISM Operating System

Syntax:
system22@VirtualBox: ~$ last

Unix file operations


Navigating filesystem and managing files and access permissions:

 ls – list files and directories


Syntax:
system22@VirtualBox: ~$ ls
Desktop Downloads Music Public Documents

 cp – copy files (work in progress)


 rm – remove files and directories (work in progress)
 mv – rename or move files and directories to another location
 chmod – change file/directory access permissions
 chown – change file/directory ownership

Text file operations in Unix

Most of important configuration in Unix is in clear text files, these commands will let
you quickly inspect files or view logs:

• cat – concatenate files and show contents to the standard output

Syntax:
system22@VirtualBox: ~$ cat > sample1
This is Sample1
Control +D to exit
Let’s see the file we just created
system22@VirtualBox: ~$ cat sample1

• more –when viewing text files or parsing Unix commands output


• less – an improved tool for viewing text files (better than more command)
• head – show the first 10 lines of text file (you can specify any number of lines)
• tail – show the last 10 lines of text file (any number can be specified)
• grep – search for patterns in text files

Unix directory management commands


Navigating filesystems and managing directories:
2
PRASHANTH C PATEL
0
SMRSISM Operating System

 mkdir – make new directory


Syntax:
system22@VirtualBox: ~$ mkdir dir_name
ex : system22@VirtualBox: ~$ mkdir bca

 rmdir – remove directories in Unix


Syntax:
system22@VirtualBox: ~$ rmdir dir_name
ex : system22@VirtualBox: ~$ rmdir bca

 cd – change directory
Syntax:
system22@VirtualBox: ~$ cd dir_name
ex : system22@VirtualBox: ~$ cd bca

 pwd – confirm current directory


Syntax:
system22@VirtualBox: ~$ pwd dir_name

 ln – make links and symlinks to files and directories


Syntax:
system22@VirtualBox: ~$ in dir_name
Unix file operations
Navigating filesystem and managing files and access permissions:
 ls – list files and directories
Syntax:
system22@VirtualBox: ~$ ls
Desktop Downloads Music Public Documents
 cp – copy files (work in progress)
Syntax:
system22@VirtualBox: ~$ cp file1 file2

 rm – remove files and directories (work in progress)


Syntax:
system22@VirtualBox: ~$ rm dir_namr
system22@VirtualBox: ~$ rm file_name
 mv – rename or move files and directories to another location
Syntax:
system22@VirtualBox: ~$ mv dir_namr new dir_name
system22@VirtualBox: ~$ mv file_name new file name

 chmod – change file/directory access permissions


2
PRASHANTH C PATEL
1
SMRSISM Operating System

Syntax:
system22@VirtualBox: ~$chmod dir_namr r
system22@VirtualBox: ~$ chmod file_name w

 chown – change file/directory ownership


Syntax:
system22@VirtualBox: ~$ chown dir_namr
system22@VirtualBox: ~$ chown file_name

Text file operations in Unix


Most of important configuration in Unix is in clear text files, these
commands will let you quickly inspect files or view logs:
• cat – concatenate files and show contents to the standard output
Syntax:
system22@VirtualBox: ~$ cat > sample1
This is Sample1
Control +D to exit
Let’s see the file we just created
system22@VirtualBox: ~$ cat sample1
 
• more –when viewing text files or parsing Unix commands output
Syntax:
system22@VirtualBox: ~$ more sample1

• less – an improved tool for viewing text files (better than more command)
Syntax:
system22@VirtualBox: ~$ less sample1

• head – show the first 10 lines of text file (you can specify any number of lines)
Syntax:
system22@VirtualBox: ~$head sample1

• tail – show the last 10 lines of text file (any number can be specified)
Syntax:
system22@VirtualBox: ~$tail sample1

• grep – search for patterns in text files


Syntax:
system22@VirtualBox: ~$grep sample1

2
PRASHANTH C PATEL
2
SMRSISM Operating System

2
PRASHANTH C PATEL
3

You might also like