SlideShare a Scribd company logo
Introduction to UNIX Concepts
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Introduction to 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.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Features of Unix:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
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.
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.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 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.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 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.
Architecture of the Unix Operating System:
 A computer system contains hardware and software that controls and
manage computer hardware, software resources, and Operating system
required for the computer.
 The operating system acts as the intermediate between hardware and
the user-defined application software. Unix is a multitasking,
multiuser operating system.
 The software is of two types:
 System software
 Application software.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 The system software provides platform for other software on the
computer . Application Software is user-defined software that works on
the system software. An operating system is a system software.
The Unix system architecture is divided by into four layers.
 Kernel
 Shell
 Commands and Utilities
 User Applications
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Unix Kernel
Kernel is the central core that interacts directly with the hardware of the
system.
The main functions of Kernel are:
 Computer hardware such as memory, disc, printers are controlled
by the kernel.
 The kernel schedules the processes, control and executes various
user-defined tasks.
 Manages the data storage
Unix Shell
 It is the interface between the user and the kernel. Users can interact
with the shell using shell commands.
 Users communicate directly with Shell. Translates user’s
commands into functions understandable by Kernel
 It interprets commands given by the users and executes them
using the kernel.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 Issues a shell prompt and waits for user response
 Provides programming ability to the users to write shell
commands
Commands and Utilities
Commands used by the Unix operating system are:
 ‘sh’ – shell commands providing a primary user interface,
 There are various commands and utilities which you can make
use of in your day to day activities. cp, mv, cat and grep
User Applications
 All the data/programs which the user writes.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
UNIX FILE SYSTEM
Introduction
 A file is one in which data can be stored .
 It is a sequence of bits , bytes or lines and stored on a storage device like
a disk.
 In unix everything is stored in terms of files.
 It could be a program , an executable code, a file, a set of instructions, a
database , a directory or a subdirectory.
 A unix file is a tool or an application that defines the structure of the
file and its format.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Unix Filenames
 Unix is case sensitive! So a file named my data. Txt is different from
mydata.txt which is again different from mydata.txt.
 Unix filenames contain only letters, numbers and
the_(underscore)&.(dot)characters. All other characters should be
avoided. The /(slash) characters is especially important/since it is used
to designate subdirectories.
 It is also possible to have additional dots in the filename.
 The part of the name that follows the dot is often used to designate the
type of file.
 Files that end in.TXT are text files.
 Files that end in .C are source code in the ‘C’ language.
 Files that end in.HTML files for the web.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 But this is just a convention and not a rule enforced by the operating
system . This is a good and sensible convention which you should
follow.
 Most UNIX system allow a maximum of 14 characters as the length of a
filename. However it depends on the UNIX variant used.
FILE SYSTEM
The unix file system is organized as a hierarchical tree structure.
The structure of a simple unix file system divided into 4 parts.
1. The Boot block
2. The Super block
3. The Inode block
4. The Data blocks
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
1) The Boot Block
 The boot block is located at the beginning of the file system.
 It can be accessed with minimal code incorporated in the computer’s
ROM bios.
 It contains the initial bootstrap program used to load the os.
2) The Super Block
 It contains statistical information to keep track of the entire file
system. Whenever disk manipulation is required, the super block is
accessed.
The Super Block contains the following information:
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
1. Size of the file system: This is the storage size of the device.
2. List of storage blocks: The storage space is divided up into a series of
standard size blocks.
3. Number of free blocks on the file system.
4. A list of free blocks with their location.
5. Index to next free block on the list.
6. A list of free inodes.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
3) The Inode Block
 Information about each file in the file system is a special kernel
structure called an inode.
 It contains a pointer to the disk blocks containing the data in the file,
information such as type of file, permission bits, the owner and group,
file size, file modification and so on.
 The name of each file is listed in the directory the file is associated
with. A directory is special type of containing a list of filenames and
associated inodes.
 When a user attempts to access a given file by name, the name is
looked up in the directory. Where the corresponding inode is found.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
An inode for a file contains the following information.:
 File ownerid : It is the numeric id used in the password file to uniquely
identify a user on the system.
 Group id (GID) : This identifies a group that can be granted special
access by the owner.
 File type : It indicates whether inode represents a
file,adirectory,aFIFO,character device.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
4) Data Block
 It contain the actual data contained in the files.
 These blocks follows the inode table and occupy most of the storage
device space.
 It allotted to one file cannot be allotted to another file, unless the two
files are linked.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
File access permissions
 User access: Access by the person who owns the file.
 Group access: Access by the members of a specified group.
 Other access: The rest of the world, who are not the owner.
Types of Access
 Read access : To be able to read the data stored in file.
 Write access : To be able to modify the data stored in file.
 Execute access : To be able to request that the system attempt to
execute the file.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Introduction to File System and Process Environment.
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.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Types of Files
The unix os is built around the concept of the a file system which is
which is used to store all of information. Including the operating sysem
kernel itself.
There are 4 types of files:
1. Ordinary or Regular files
2. Directory files
3. Device files or special files
4. Hidden files
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
1.Regular or ordinary files:
It can contain text, data, or program information, files cannot
contain other files or directories. Instead use the underscore(’_’)
symbol. it is ordinary file.
An ordinary file can be of 2 types.
i. Text file
ii. Binary
I. Text File: A text file contains only printable characters. It contains line
of character, each line terminated by a newline character .
Ex: text files include c and Java program ,shell and perl scripts.
II. Binary File: A binary file contains both printable and unprintable
character(0 to 255 ASCII code).
Ex: binary files include unix command ,object code of c programs
,pictures , sound , and video files. file
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
2. Directory files :
Directories are containers or folders that hold files, and other
directories . Directories can point to other directories which are known
as Sub directories.
The directories generally contains files and other sub directories along
with their link information . normally a directory contains 2 pieace of
information.
i. The file name
ii. A unique identification number.
When a user creates or remove a file ,the kernel updates the
corresponding directory by adding or removing the inode number and
files name associated with the file.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
3. Device files :
To provide applications, with easy access to hardware devices. UNIX
allows them to be used in much the same way as ordinary files. The
video screen of your pc , RAM , disk , input ports and other such
devices are usually accessed through device file.
Two types of device files in unix:
 Block-oriented :Block-oriented devices which transfer data in blocks.
EX: Hard disk
 Character-oriented: Character oriented devices that transfer data on a
byte –by byte basis( eg. modems , printers and networks).
 Hidden files : The filename can begin with a dot character is called
hidden file.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Types of users
1. The owner of file(user)
2. The users who belong to the same group as the file(group)
3. Everyone else(other)
UNIX Directory Structure
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
 Directories are organised into a hierarchical structure that fan out like
an upside own tree.
 The top most directory is known as root and it is written as (/).
 The roots contains subdirectory and each of these can contains more
subdirectory and so on.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Directory Contents
/ The root directory
/bin Essential low-level system utilities
/usr/bin Higher-level system utilities and application programs
/sbin Super user system utilities (for performing system
administration tasks )
/lib Program libraries (collections of system calls that can be
included in programs by a compiler)for low level system utilities.
/usr/lib Program libraries for higher level user programs
/tmp Temporary file storage space (can be used by any user)
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Directory Contents
/dev Holds the files /device drivers necessary to operate peripherals
such as terminals , keyboard, printer , hard disk etc
/var Contains files that vary in size , mail
Directories , printer , spool file , logs etc..
/usr/include Contains standard headed files used by c programs
/home User home directories containing personal file space for
each user. each directory is named after the login of the user.
/etc Unix system configuration and information files.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
File access methods
Owner:
 It is the owner of the file . the owner’s permissions determine what
actions the owner of the File can perform on the file.
Group:
 It gives the name of the group . the groups permissions determine what
actions a user, who is a member of the group that a file belongs to , can
perform on the file.
Other:
 the rest of the world who are not the owner . the permissions for others
indicate what action all other users can perform on the file.
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
File and Directory related commands
1.Ls command : listing files
It is used to display all the files and sub directories in a current directory.
Syntax : ls options filename
Ls options :
-a : list all files including hidden files . Hidden file names start with a dot
character.
A single dot (.) refers to the current directory and a double dot (..) refer
to the parent Directory .
-x : list the content in a row – wise format.
-r : list contents , sorted in reverse alphabetical order.
*t : list all files ending with letter t .
t* : list all file names starting with letter t .
-u : list the contents based on the access time or using time .
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
2.Cat command : it is used to
i. Creating files :
cat command can be used to create small files
syntax :
cat options input file
Example : $cat > fruits
Apple
Banana
Orange
<ctrl d> or (ctrl + d)
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
ii. Displaying contents of a file :
cat display only the contents of the file
syntax :
$cat filename
Ex :
$cat > veg
Carrot
Beans
Tomato
< ctrl + d>
$cat fruits veg
Apple
Banana
orange
carrot
Beans
Tomato
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
iii. Concatenation of files :
 Cat command can concatenate the contents of two or more files and
start
 Store then in another file.
Syntax :
$cat test1 test2 > test3
Ex $cat fruits veg > food
$cat food
Apple
Banana
Orange
Carrot
Beans
Tomato
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
iv. Append files :
Cat command is to append or add data to the contents of the file
Syntax :
$cat >> filname1
Ex :
$cat fruit1
Grapes
(ctrl + d)
Options
-v : displays non-printable ASCII characters.
-n : numbers the lines in the file .
-s : silent (no error messages).
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
3.Cal command :
Cal command is used to print the calendar of a required month or year
Syntax :
cal { [month] year }
Ex :
$cal 2013 | more
Date and time command :
it displays the current date with time .
syntax :
date options arguments
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
options :
d : day of the month.
y : last two digits of the year .
H,M& S : hour ,minutes,seconds.
D : date in mm/dd/yy format .
T :time in hh : mm : ss format .
h :month name.
a :day of week.
Ex :
$date
Sat jan 05 15:35:30 1st 2016
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
4.Who Command:
 Who command provides the login details of all current users in 3
columns format.
Syntax :
 Who options am i
 First column shows login names , second column shows the devices
names of the terminals and third column shows the login date and
time .
Options :
-H :displays headers for the columns .
U :displays more details including idle time ,PID and comments .
PID is the process – ID , which is a unique number identifying a process .
Who am i gives the self login details of a week .
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
5.Printf : print formatted output command .
it is used to write formatted output .
syntax :
print f format arguments
TTY : terminal command
It is used to known the name of the device file .
Syntax :
tty
Ex :
$tty
/dev/pts /1
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
6.Uname : system name command
It is used to know the name and certain features of the system
Syntax :
Uname options
Options
-v :prints the versions of os .
-a :options displays all deatails of the system .
-m :machine details .
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
7.Passwd
It is used to change password in passwd .
Syntax :
$passwd
8.echo :
it is usually used in shell scripts to display messages on the terminal
Syntax :
echo options arguments
Ex :
$echo I am studying in 2 Bca
I am studying in 2 Bca
$echo “ I am studing in 2 Bca “
I am studing in 2 Bca
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
9.Bc : calculator command
there are two types of calculator .
1. Xcalc :it is a graphical object which
is used only on x- window system and is easy to use .
2. bc : it is a text – based command .
it behaves both as base calculator and a small language .
it can perform all arithmetic operations .
Syntax :
bc arguments
Ex :$bc $bc $bc
15+5 sqrt(49)10/3
20 7 3
21 22 23
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
10.Pwd : print working directory command
Pwd in a command that prints the absolute pathname of your current
working directory
Syntax :
Pwd
Ex :
$pwd
/home/rama
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
11.The home directory :
When you log into unix ,your current working directory is your user
home directory.
we can refer to home directory at any times as (tilde)” ~ ” .
so, ~std2/play is another way for user std 1 tp specify an absolute path
to the directory /home/std2/play ,user std2 may refer to the directory as
~ /play .
The home directory can be found using a shell variable called HOME
as shown :
$ echo $HOME
/home/rama
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
12.Pathnames :
It is the notation used to point to the particular file or directory
Pathnames is divided in to two
a) Absolute path
b) Relative path
a) Absolute path :
Absolute path all ways starts from root directory (/) .
Ex :
User /jen /person
b) Relative path :
It points to a file or directory relative to your current working directory .
Ex :
Person /art.html
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
13.Cd-changing the directory
It is used to move from one directory to another.it uses a pathname as its
arguments.
.(single dot)means current
directory.
..(double dot)means the parent
directory.
~(tilde)means your home directory.
A plain cd without pathname brings
you back to your home directory.
Syntax
Cd pathname
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Ex :$pwd
/home/rama
$mkdir partha
$cd partha
$pwd
/home/rama/partha
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
14.mkdir:making directors
mkdir command is used to create new directories.
Syntax:
mkdir options dir-names
ex:$mkdirranjitha
$cd ranjitha
ranjitha $ pwd
/home/ranjitha
15.rmdir:
It removes one or more directories or subdirectories.
Syntax
rmdir dir-names
ex: $cd
$rmdir ranjitha
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
16. touch :
The ‘$ touch’ command creates a file(not directory) and you can simple
add an extension such as .txt after it to make it a Text File.
$ to
17. cp :
This ‘$ cp ‘ command stands for ‘copy’ and it simply copy/paste the file
wherever you want to.
$ cp
18. mv :
The ‘$ mv’ command stands for ‘move’ and it simply move a file from a
directory to another directory.
$ mv
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
19. rm : The ‘$ rm ‘ command for remove and the ‘-r’ simply recursively
deletes file. Try ‘$ rm filename.txt’ at your terminal
$ rm
20. chmod :
The ‘$ chmod’ command stands for change mode command.As there are
many modes in Unix that can be used to manipulate files in the Unix
environment. Basically there are 3 modes that we can use with the
‘chmod’ command
1. +w (stands for write and it changes file permissions to write)
2. +r (stands for read and it changes file permissions to read)
3. +x (generally it is used to m
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
21. file:
The ‘$ file’ command displays the type of file . As Linux treats everything
as a file so on executing the command file on a directory(Downloads) it
displays directory as the output
$ ls
22. sort :
As the name suggests the ‘$ sort’ sorts the contents of the file according to
the ASCII rules.
$ sort
23. grep :
grep is an acronym for ‘globally search a regular expression and print it’.
The ‘$ grep’ command searches the specified input fully(globally) for a
match with the supplied pattern and displays it.
$ grep
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
24.man :
The ‘$ man’ command stands for ‘manual’ and it can display the in-built
manual for most of the commands that we ever need.
$ man
25. lpr :
The ‘$ lpr’ command send a file to the printer for printing.
$ lpr
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
26. clear :
The ‘$ clear’ command is used to clean up the terminal so that you can
type with more accuracy
$ clear
27. history :
The ‘$ history’ command is used to get list of previous commands may be
obtained by executing the following command. you can also use
parameters like !n to re-execute the nth command, !! to executes the most
recent command, and !cp this will execute the most recent command that
starts with cp.
$ history
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
Thanks !!!
Mrs.Harsha V Patil, MIT ACSC Alandi , Pune

More Related Content

PPT
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
DOCX
UNIT II-Programming in Linux
PPTX
Unix operating system architecture with file structure
PPTX
Introduction to Unix
PPTX
Operating system
PPT
Spsl unit1
PPT
Unix Tutorial & overview
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
UNIT II-Programming in Linux
Unix operating system architecture with file structure
Introduction to Unix
Operating system
Spsl unit1
Unix Tutorial & overview

Similar to Introduction to Unix Concets.pptx (20)

PPTX
Unix Operating System
PPTX
Unix case-study
PPT
LinuxOS-1 (1).ppt
PPT
Unix/Linux Basic Commands and Shell Script
PPTX
Unix and shell programming | Unix File System | Unix File Permission | Blocks
PPTX
Introduction to unix (1).pptx
PPT
linux system and network administrations
PDF
UNIX_Module 1.pdf
PPTX
Operating systems unix
PPT
DOCX
Introduction to unix
PPT
16. Computer Systems Basic Software 2
PPTX
UNIX_module1.pptx
DOC
Introduction to unix
DOC
computer notes - Unix primer
PPTX
Chapter 2 Introduction to Unix Concepts
PPT
Host security
PPT
Host security
PDF
1_Introduction_To_Unix_and_Basic_Unix_Commands
PPTX
CHAPTER 1 INTRODUCTION TO UNIX.pptx
Unix Operating System
Unix case-study
LinuxOS-1 (1).ppt
Unix/Linux Basic Commands and Shell Script
Unix and shell programming | Unix File System | Unix File Permission | Blocks
Introduction to unix (1).pptx
linux system and network administrations
UNIX_Module 1.pdf
Operating systems unix
Introduction to unix
16. Computer Systems Basic Software 2
UNIX_module1.pptx
Introduction to unix
computer notes - Unix primer
Chapter 2 Introduction to Unix Concepts
Host security
Host security
1_Introduction_To_Unix_and_Basic_Unix_Commands
CHAPTER 1 INTRODUCTION TO UNIX.pptx
Ad

More from Harsha Patil (20)

PDF
Unit 5-Introduction of GUI Programming-Part2.pdf
PDF
Unit 3-Classes ,Objects and Inheritance.pdf
PDF
Unit 6-Introduction of Python Libraries.pdf
PDF
Unit 5-Introduction of GUI Programming-Part1.pdf
PDF
Unit-2 Introduction of Modules and Packages.pdf
PDF
Unit 4-Exception Handling in Python.pdf
PDF
Unit 1-Part-4-Lists, tuples and dictionaries.pdf
PDF
Unit 1-Part-1-Introduction to Python.pdf
PDF
Unit 1-Part-5-Functions and Set Operations.pdf
PDF
Unit 1-Part-3 - String Manipulation.pdf
PDF
Unit 1- Part-2-Control and Loop Statements.pdf
PPTX
Introduction to Reinforcement Learning.pptx
PPTX
Introduction to Association Rules.pptx
PPTX
Introduction to Clustering . pptx
PPTX
Introduction to Classification . pptx
PPTX
Introduction to Regression . pptx
PPTX
Intro of Machine Learning Models .pptx
PPTX
Introduction to Machine Learning.pptx
PPTX
Unit-V-Introduction to Data Mining.pptx
PPTX
Unit-IV-Introduction to Data Warehousing .pptx
Unit 5-Introduction of GUI Programming-Part2.pdf
Unit 3-Classes ,Objects and Inheritance.pdf
Unit 6-Introduction of Python Libraries.pdf
Unit 5-Introduction of GUI Programming-Part1.pdf
Unit-2 Introduction of Modules and Packages.pdf
Unit 4-Exception Handling in Python.pdf
Unit 1-Part-4-Lists, tuples and dictionaries.pdf
Unit 1-Part-1-Introduction to Python.pdf
Unit 1-Part-5-Functions and Set Operations.pdf
Unit 1-Part-3 - String Manipulation.pdf
Unit 1- Part-2-Control and Loop Statements.pdf
Introduction to Reinforcement Learning.pptx
Introduction to Association Rules.pptx
Introduction to Clustering . pptx
Introduction to Classification . pptx
Introduction to Regression . pptx
Intro of Machine Learning Models .pptx
Introduction to Machine Learning.pptx
Unit-V-Introduction to Data Mining.pptx
Unit-IV-Introduction to Data Warehousing .pptx
Ad

Recently uploaded (20)

PPTX
How to Manage Bill Control Policy in Odoo 18
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
PDF
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
PPTX
Congenital Hypothyroidism pptx
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Odoo 18 Sales_ Managing Quotation Validity
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
PPTX
Software Engineering BSC DS UNIT 1 .pptx
PPTX
Introduction and Scope of Bichemistry.pptx
PDF
UTS Health Student Promotional Representative_Position Description.pdf
PPTX
Strengthening open access through collaboration: building connections with OP...
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Types of Literary Text: Poetry and Prose
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
An introduction to Prepositions for beginners.pptx
PDF
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
How to Manage Bill Control Policy in Odoo 18
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
NOI Hackathon - Summer Edition - GreenThumber.pptx
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
Congenital Hypothyroidism pptx
Open Quiz Monsoon Mind Game Prelims.pptx
Week 4 Term 3 Study Techniques revisited.pptx
Odoo 18 Sales_ Managing Quotation Validity
Information Texts_Infographic on Forgetting Curve.pptx
Software Engineering BSC DS UNIT 1 .pptx
Introduction and Scope of Bichemistry.pptx
UTS Health Student Promotional Representative_Position Description.pdf
Strengthening open access through collaboration: building connections with OP...
How to Manage Loyalty Points in Odoo 18 Sales
Open Quiz Monsoon Mind Game Final Set.pptx
Types of Literary Text: Poetry and Prose
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
An introduction to Prepositions for beginners.pptx
LDMMIA Reiki Yoga Workshop 15 MidTerm Review

Introduction to Unix Concets.pptx

  • 1. Introduction to UNIX Concepts Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 2. Introduction to 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. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 3. Features of Unix: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 4. 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. 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. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 5.  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. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 6.  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. Architecture of the Unix Operating System:  A computer system contains hardware and software that controls and manage computer hardware, software resources, and Operating system required for the computer.  The operating system acts as the intermediate between hardware and the user-defined application software. Unix is a multitasking, multiuser operating system.  The software is of two types:  System software  Application software. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 7.  The system software provides platform for other software on the computer . Application Software is user-defined software that works on the system software. An operating system is a system software. The Unix system architecture is divided by into four layers.  Kernel  Shell  Commands and Utilities  User Applications Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 8. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 9. Unix Kernel Kernel is the central core that interacts directly with the hardware of the system. The main functions of Kernel are:  Computer hardware such as memory, disc, printers are controlled by the kernel.  The kernel schedules the processes, control and executes various user-defined tasks.  Manages the data storage Unix Shell  It is the interface between the user and the kernel. Users can interact with the shell using shell commands.  Users communicate directly with Shell. Translates user’s commands into functions understandable by Kernel  It interprets commands given by the users and executes them using the kernel. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 10.  Issues a shell prompt and waits for user response  Provides programming ability to the users to write shell commands Commands and Utilities Commands used by the Unix operating system are:  ‘sh’ – shell commands providing a primary user interface,  There are various commands and utilities which you can make use of in your day to day activities. cp, mv, cat and grep User Applications  All the data/programs which the user writes. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 11. UNIX FILE SYSTEM Introduction  A file is one in which data can be stored .  It is a sequence of bits , bytes or lines and stored on a storage device like a disk.  In unix everything is stored in terms of files.  It could be a program , an executable code, a file, a set of instructions, a database , a directory or a subdirectory.  A unix file is a tool or an application that defines the structure of the file and its format. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 12. Unix Filenames  Unix is case sensitive! So a file named my data. Txt is different from mydata.txt which is again different from mydata.txt.  Unix filenames contain only letters, numbers and the_(underscore)&.(dot)characters. All other characters should be avoided. The /(slash) characters is especially important/since it is used to designate subdirectories.  It is also possible to have additional dots in the filename.  The part of the name that follows the dot is often used to designate the type of file.  Files that end in.TXT are text files.  Files that end in .C are source code in the ‘C’ language.  Files that end in.HTML files for the web. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 13.  But this is just a convention and not a rule enforced by the operating system . This is a good and sensible convention which you should follow.  Most UNIX system allow a maximum of 14 characters as the length of a filename. However it depends on the UNIX variant used. FILE SYSTEM The unix file system is organized as a hierarchical tree structure. The structure of a simple unix file system divided into 4 parts. 1. The Boot block 2. The Super block 3. The Inode block 4. The Data blocks Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 14. 1) The Boot Block  The boot block is located at the beginning of the file system.  It can be accessed with minimal code incorporated in the computer’s ROM bios.  It contains the initial bootstrap program used to load the os. 2) The Super Block  It contains statistical information to keep track of the entire file system. Whenever disk manipulation is required, the super block is accessed. The Super Block contains the following information: Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 15. 1. Size of the file system: This is the storage size of the device. 2. List of storage blocks: The storage space is divided up into a series of standard size blocks. 3. Number of free blocks on the file system. 4. A list of free blocks with their location. 5. Index to next free block on the list. 6. A list of free inodes. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 16. 3) The Inode Block  Information about each file in the file system is a special kernel structure called an inode.  It contains a pointer to the disk blocks containing the data in the file, information such as type of file, permission bits, the owner and group, file size, file modification and so on.  The name of each file is listed in the directory the file is associated with. A directory is special type of containing a list of filenames and associated inodes.  When a user attempts to access a given file by name, the name is looked up in the directory. Where the corresponding inode is found. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 17. An inode for a file contains the following information.:  File ownerid : It is the numeric id used in the password file to uniquely identify a user on the system.  Group id (GID) : This identifies a group that can be granted special access by the owner.  File type : It indicates whether inode represents a file,adirectory,aFIFO,character device. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 18. 4) Data Block  It contain the actual data contained in the files.  These blocks follows the inode table and occupy most of the storage device space.  It allotted to one file cannot be allotted to another file, unless the two files are linked. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 19. File access permissions  User access: Access by the person who owns the file.  Group access: Access by the members of a specified group.  Other access: The rest of the world, who are not the owner. Types of Access  Read access : To be able to read the data stored in file.  Write access : To be able to modify the data stored in file.  Execute access : To be able to request that the system attempt to execute the file. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 20. Introduction to File System and Process Environment. 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. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 21. Types of Files The unix os is built around the concept of the a file system which is which is used to store all of information. Including the operating sysem kernel itself. There are 4 types of files: 1. Ordinary or Regular files 2. Directory files 3. Device files or special files 4. Hidden files Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 22. 1.Regular or ordinary files: It can contain text, data, or program information, files cannot contain other files or directories. Instead use the underscore(’_’) symbol. it is ordinary file. An ordinary file can be of 2 types. i. Text file ii. Binary I. Text File: A text file contains only printable characters. It contains line of character, each line terminated by a newline character . Ex: text files include c and Java program ,shell and perl scripts. II. Binary File: A binary file contains both printable and unprintable character(0 to 255 ASCII code). Ex: binary files include unix command ,object code of c programs ,pictures , sound , and video files. file Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 23. 2. Directory files : Directories are containers or folders that hold files, and other directories . Directories can point to other directories which are known as Sub directories. The directories generally contains files and other sub directories along with their link information . normally a directory contains 2 pieace of information. i. The file name ii. A unique identification number. When a user creates or remove a file ,the kernel updates the corresponding directory by adding or removing the inode number and files name associated with the file. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 24. 3. Device files : To provide applications, with easy access to hardware devices. UNIX allows them to be used in much the same way as ordinary files. The video screen of your pc , RAM , disk , input ports and other such devices are usually accessed through device file. Two types of device files in unix:  Block-oriented :Block-oriented devices which transfer data in blocks. EX: Hard disk  Character-oriented: Character oriented devices that transfer data on a byte –by byte basis( eg. modems , printers and networks).  Hidden files : The filename can begin with a dot character is called hidden file. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 25. Types of users 1. The owner of file(user) 2. The users who belong to the same group as the file(group) 3. Everyone else(other) UNIX Directory Structure Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 26.  Directories are organised into a hierarchical structure that fan out like an upside own tree.  The top most directory is known as root and it is written as (/).  The roots contains subdirectory and each of these can contains more subdirectory and so on. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 27. Directory Contents / The root directory /bin Essential low-level system utilities /usr/bin Higher-level system utilities and application programs /sbin Super user system utilities (for performing system administration tasks ) /lib Program libraries (collections of system calls that can be included in programs by a compiler)for low level system utilities. /usr/lib Program libraries for higher level user programs /tmp Temporary file storage space (can be used by any user) Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 28. Directory Contents /dev Holds the files /device drivers necessary to operate peripherals such as terminals , keyboard, printer , hard disk etc /var Contains files that vary in size , mail Directories , printer , spool file , logs etc.. /usr/include Contains standard headed files used by c programs /home User home directories containing personal file space for each user. each directory is named after the login of the user. /etc Unix system configuration and information files. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 29. File access methods Owner:  It is the owner of the file . the owner’s permissions determine what actions the owner of the File can perform on the file. Group:  It gives the name of the group . the groups permissions determine what actions a user, who is a member of the group that a file belongs to , can perform on the file. Other:  the rest of the world who are not the owner . the permissions for others indicate what action all other users can perform on the file. Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 30. File and Directory related commands 1.Ls command : listing files It is used to display all the files and sub directories in a current directory. Syntax : ls options filename Ls options : -a : list all files including hidden files . Hidden file names start with a dot character. A single dot (.) refers to the current directory and a double dot (..) refer to the parent Directory . -x : list the content in a row – wise format. -r : list contents , sorted in reverse alphabetical order. *t : list all files ending with letter t . t* : list all file names starting with letter t . -u : list the contents based on the access time or using time . Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 31. 2.Cat command : it is used to i. Creating files : cat command can be used to create small files syntax : cat options input file Example : $cat > fruits Apple Banana Orange <ctrl d> or (ctrl + d) Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 32. ii. Displaying contents of a file : cat display only the contents of the file syntax : $cat filename Ex : $cat > veg Carrot Beans Tomato < ctrl + d> $cat fruits veg Apple Banana orange carrot Beans Tomato Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 33. iii. Concatenation of files :  Cat command can concatenate the contents of two or more files and start  Store then in another file. Syntax : $cat test1 test2 > test3 Ex $cat fruits veg > food $cat food Apple Banana Orange Carrot Beans Tomato Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 34. iv. Append files : Cat command is to append or add data to the contents of the file Syntax : $cat >> filname1 Ex : $cat fruit1 Grapes (ctrl + d) Options -v : displays non-printable ASCII characters. -n : numbers the lines in the file . -s : silent (no error messages). Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 35. 3.Cal command : Cal command is used to print the calendar of a required month or year Syntax : cal { [month] year } Ex : $cal 2013 | more Date and time command : it displays the current date with time . syntax : date options arguments Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 36. options : d : day of the month. y : last two digits of the year . H,M& S : hour ,minutes,seconds. D : date in mm/dd/yy format . T :time in hh : mm : ss format . h :month name. a :day of week. Ex : $date Sat jan 05 15:35:30 1st 2016 Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 37. 4.Who Command:  Who command provides the login details of all current users in 3 columns format. Syntax :  Who options am i  First column shows login names , second column shows the devices names of the terminals and third column shows the login date and time . Options : -H :displays headers for the columns . U :displays more details including idle time ,PID and comments . PID is the process – ID , which is a unique number identifying a process . Who am i gives the self login details of a week . Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 38. 5.Printf : print formatted output command . it is used to write formatted output . syntax : print f format arguments TTY : terminal command It is used to known the name of the device file . Syntax : tty Ex : $tty /dev/pts /1 Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 39. 6.Uname : system name command It is used to know the name and certain features of the system Syntax : Uname options Options -v :prints the versions of os . -a :options displays all deatails of the system . -m :machine details . Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 40. 7.Passwd It is used to change password in passwd . Syntax : $passwd 8.echo : it is usually used in shell scripts to display messages on the terminal Syntax : echo options arguments Ex : $echo I am studying in 2 Bca I am studying in 2 Bca $echo “ I am studing in 2 Bca “ I am studing in 2 Bca Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 41. 9.Bc : calculator command there are two types of calculator . 1. Xcalc :it is a graphical object which is used only on x- window system and is easy to use . 2. bc : it is a text – based command . it behaves both as base calculator and a small language . it can perform all arithmetic operations . Syntax : bc arguments Ex :$bc $bc $bc 15+5 sqrt(49)10/3 20 7 3 21 22 23 Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 42. 10.Pwd : print working directory command Pwd in a command that prints the absolute pathname of your current working directory Syntax : Pwd Ex : $pwd /home/rama Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 43. 11.The home directory : When you log into unix ,your current working directory is your user home directory. we can refer to home directory at any times as (tilde)” ~ ” . so, ~std2/play is another way for user std 1 tp specify an absolute path to the directory /home/std2/play ,user std2 may refer to the directory as ~ /play . The home directory can be found using a shell variable called HOME as shown : $ echo $HOME /home/rama Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 44. 12.Pathnames : It is the notation used to point to the particular file or directory Pathnames is divided in to two a) Absolute path b) Relative path a) Absolute path : Absolute path all ways starts from root directory (/) . Ex : User /jen /person b) Relative path : It points to a file or directory relative to your current working directory . Ex : Person /art.html Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 45. 13.Cd-changing the directory It is used to move from one directory to another.it uses a pathname as its arguments. .(single dot)means current directory. ..(double dot)means the parent directory. ~(tilde)means your home directory. A plain cd without pathname brings you back to your home directory. Syntax Cd pathname Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 46. Ex :$pwd /home/rama $mkdir partha $cd partha $pwd /home/rama/partha Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 47. 14.mkdir:making directors mkdir command is used to create new directories. Syntax: mkdir options dir-names ex:$mkdirranjitha $cd ranjitha ranjitha $ pwd /home/ranjitha 15.rmdir: It removes one or more directories or subdirectories. Syntax rmdir dir-names ex: $cd $rmdir ranjitha Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 48. 16. touch : The ‘$ touch’ command creates a file(not directory) and you can simple add an extension such as .txt after it to make it a Text File. $ to 17. cp : This ‘$ cp ‘ command stands for ‘copy’ and it simply copy/paste the file wherever you want to. $ cp 18. mv : The ‘$ mv’ command stands for ‘move’ and it simply move a file from a directory to another directory. $ mv Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 49. 19. rm : The ‘$ rm ‘ command for remove and the ‘-r’ simply recursively deletes file. Try ‘$ rm filename.txt’ at your terminal $ rm 20. chmod : The ‘$ chmod’ command stands for change mode command.As there are many modes in Unix that can be used to manipulate files in the Unix environment. Basically there are 3 modes that we can use with the ‘chmod’ command 1. +w (stands for write and it changes file permissions to write) 2. +r (stands for read and it changes file permissions to read) 3. +x (generally it is used to m Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 50. 21. file: The ‘$ file’ command displays the type of file . As Linux treats everything as a file so on executing the command file on a directory(Downloads) it displays directory as the output $ ls 22. sort : As the name suggests the ‘$ sort’ sorts the contents of the file according to the ASCII rules. $ sort 23. grep : grep is an acronym for ‘globally search a regular expression and print it’. The ‘$ grep’ command searches the specified input fully(globally) for a match with the supplied pattern and displays it. $ grep Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 51. 24.man : The ‘$ man’ command stands for ‘manual’ and it can display the in-built manual for most of the commands that we ever need. $ man 25. lpr : The ‘$ lpr’ command send a file to the printer for printing. $ lpr Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 52. 26. clear : The ‘$ clear’ command is used to clean up the terminal so that you can type with more accuracy $ clear 27. history : The ‘$ history’ command is used to get list of previous commands may be obtained by executing the following command. you can also use parameters like !n to re-execute the nth command, !! to executes the most recent command, and !cp this will execute the most recent command that starts with cp. $ history Mrs.Harsha V Patil, MIT ACSC Alandi , Pune
  • 53. Thanks !!! Mrs.Harsha V Patil, MIT ACSC Alandi , Pune