Module I

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Introduction to Operating System

What is Operating System


An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.
An operating System (OS) is an intermediary between users and computer hardware. It provides
users an environment in which a user can execute programs conveniently and efficiently.
In technical terms, it is software which manages hardware. An operating System controls the
allocation of resources and services such as memory, processors, devices and information.
Different computer system may have different operating system.
For example
 The most common Operating System for personal computers are DOS, OS/2 and WINDOWS.
 Mainframe computers may use Digital Equipment‟s VAX operating System or IBM‟S System 370.
 Networks also have Operating System, such as LINUX and WINDOWS NT and UNIX
Type of Operating System
PC Operating System
A Personal Computer system or PC is usually a standalone machine, such as a Desktop or Laptop
computer.
A PC Operating System conducts all the inputs, output, processing and storage operations on a
single computer.
Some popular PC Operating System
Microsoft Windows Microsoft Dos Linux Apple Macintosh IBM OS/2
Mainframe Operating System
A mainframe Operating System controls a mainframe system, a large computer system with multiple
processors that conducts input, output, processing and storage operations for many users.
Some recognized mainframe Operating System are: -
1) Digital Equipment VAX systems 2) Hewlett Packard HP 9000 series.
Network Operating System
 A computer network combines the convenience and familiarity of the personal computer with
processing power of the mainframe.
 A network lets multiple users share computer resources and files.
 A network Operating System controls the operations of a server computer, sometimes called a
host computer, which accepts requests from user programs running on other machine called
clients.
 In a centralized approach all the user‟s data and application reside on the server.
 This type of network is called a server-based network.
 The system administration easily maintains the user‟s applications on the server.
 If the server fails however the entire network fails.
What is Unix :
The UNIX operating system is a set of programs that act as a link between the computer and the
user. The computer programs that allocate the system resources and coordinate all the details of the
computer's internals is called the operating system or kernel.
Users communicate with the kernel through a program known as the shell. The shell is a command
line interpreter; it translates commands entered by the user and converts them into a language that is
understood by the kernel.
 Unix was originally developed in 1969 by a group of AT&T employees at Bell Labs, including
Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna.
 There are various Unix variants available in the market. Solaris Unix, AIX, HP Unix and BSD
are few examples. Linux is also a flavor of Unix which is freely available.
 Several people can use a UNIX computer at the same time; hence UNIX is called a multiuser
system.
 A user can also run multiple programs at the same time; hence UNIX is called multitasking
A Brief History of UNIX
In the late 1960s, researchers from General Electric, MIT and Bell Labs launched a joint project to
develop an ambitious multi-user, multi-tasking OS for mainframe computers known as MULTICS
(Multiplexed Information and Computing System). MULTICS failed, but it did inspire Ken Thompson,
who was a researcher at Bell Labs, to have a go at writing a simpler operating system himself. He
wrote a simpler version of MULTICS on a PDP7 in assembler and called his attempt UNICS
(Uniplexed Information and Computing System). Because memory and CPU power were at a
premium in those days, UNICS (eventually shortened to UNIX) used short commands to minimize the
space needed to store them and the time needed to decode them - hence the tradition of short UNIX
commands we use today.
Ken Thompson then teamed up with Dennis Ritchie, the author of the first C compiler in 1973. They
rewrote the UNIX kernel in C - this was a big step forwards in terms of the system's portability - and
released the Fifth Edition of UNIX to universities in 1974. The Seventh Edition, released in 1978,
marked a split in UNIX development into two main branches: SYSV (System 5) and BSD (Berkeley
Software Distribution). BSD arose from the University of California at Berkeley where Ken Thompson
spent a sabbatical year. Its development was continued by students at Berkeley and other research
institutions. SYSV was developed by AT&T and other commercial companies. UNIX flavors based on
SYSV have traditionally been more conservative, but better supported than BSD-based flavors.
Until recently, UNIX standards were nearly as numerous as its variants. In early days, AT&T
published a document called System V Interface Definition (SVID). X/OPEN (now The Open Group),
a consortium of vendors and users, had one too, in the X/Open Portability Guide (XPG). In the US,
yet another set of standards, named Portable Operating System Interface for Computer Environments
(POSIX), were developed at the behest of the Institution of Electrical and Electronics Engineers
(IEEE).
In 1998, X/OPEN and IEEE undertook an ambitious program of unifying the two standards. In 2001,
this joint initiative resulted in a single specification called the Single UNIX Specification, Version 3
(SUSV3), that is also known as IEEE 1003.1:2001 (POSIX.1). In 2002, the International Organization
for Standardization (ISO) approved SUSV3 and IEEE 1003.1:2001.
Some of the commercial UNIX based on system V are:
IBM's AIX
Hewlett-Packard's HPUX
SCO's Open Server Release 5
Silicon Graphics' IRIS
DEC's Digital UNIX
Sun Microsystems' Solaris 2
Some of the commercial UNIX based on BSD are:
SunOS 4.1.X (now Solaris)
DEC's Ultris
BSD/OS, 4.4BSD
Some Free UNIX are:
Linux, written by Linus Torvalds at University of Helsinki in Finland.
FreeBSD and NetBSD, a derivative of 4.4BSD
Features of UNIX Operating System
Several features of UNIX which made it popular. Some of them are:
Portable
UNIX can be installed on many hardware platforms. Its widespread use can be traced to the decision
to develop it using the C language.
Multiuser
The UNIX design allows multiple users to concurrently share hardware and software
Multitasking
UNIX allows a user to run more than one program at a time. In fact more than one program can be
running in the background while a user is working foreground.
Networking
While UNIX was developed to be an interactive, multiuser, multitasking system, networking is also
incorporated into the heart of the operating system. Access to another system uses a standard
communications protocol known as Transmission Control Protocol/Internet Protocol (TCP/IP).
Organized File System
UNIX has a very organized file and directory system that allows users to organize and maintain files.
Modularity
One of the unique feature of Unix system is its modular design. The Unix system comes with a large
number of utility programs which are designed to independently perform a specific task.
System Security
Unix being a multi-user operating system offers protection of one user‟s information from another. It
maintains a list of users who are allowed to access the system. It also keeps track of what files and
resources each user is authorized to use.
File Security System
Unix provides security at file and directory level. Read, Write and Execute permissions are given to
each file at three levels.
I/O Redirection and Piping
Unix commands are designed in such a way that they input from a conceptual file called the Standard
Input and send their output to another conceptual file called the Standard Output. Unix has a facility
called Piping, by which output of one command acts as the input of another command. Pipes allow
data to be processed by a sequence of command and precludes the use of temporary file and hence
speeds up the operation.
Device Independence
UNIX treats input/output devices like ordinary files. The source or destination for file input and output
is easily controlled through a UNIX design feature called redirection.
Utilities
UNIX provides a rich library of utilities that can be use to increase user productivity.

Login and Logout Procedure


Accessing Unix:
When you first connect to a UNIX system, you usually see a prompt such as the following
To log in:
1. Have your user-id (user identification) and password ready. Contact your system administrator
if you don't have these yet.
2. Type your user-id at the login prompt, then press ENTER. Your user-id is case-sensitive, so be
sure you type it exactly as your system administrator instructed.
3. Type your password at the password prompt, then press ENTER. Your password is also case
sensitive.
4. If you provided correct user-id and password then you would be allowed to enter into the
system.
Read the in format and messages that come up on the screen something as below.
login : <User name>
User name password:
Last login: Sun Jan 16 09:32:32 2021 from 62.61.164.73
You would be provided with a command prompt ( sometime called $ prompt ) where you would type
your all the commands.
Logging Out:
When you finish your session, you need to log out of the system to ensure that nobody else accesses
your files while masquerading as you.
To log out:
Just type logout command at command prompt, and the system will clean up everything and break
the connection
Introductory Commands
date: Displays the system date and time.
Syntax: date [+format]
Example: Display the date in dd/mm/yy format
$ date +%d/%m/%y
cal: Displays the calendar.
Syntax: cal [[month] year]
Example: display the calendar for April 2018
$ cal 4 2018
banner: Prints a large banner on the standard output.
Syntax: banner message
Example: Print “Unix” as the banner
$ banner Unix
Who Are You
While you're logged in to the system, you might be willing to know : Who am I?
The easiest way to find out "who you are" is to enter the whoami command:
$ whoami displays the respective user name
xyz
$ who display information about all users currently logged onto the system.
amar ttyp0 Jan 18 14:10
ankita ttyp2 Jan 14 09:08
vivek ttyp4 Jan 8 12:09
Change Password:
All Unix systems require passwords to help ensure that your files and data remain your own and that
the system itself is secure from hackers and crackers. Here are the steps to change your password:
1. To start, type passwd at command prompt as shown below.
2. Enter your old password the one you're currently using.
3. Type in your new password. Always keep your password complex enough so that no body can
guess it. But make sure, you remember it.
4. You would need to verify the password by typing it again.
$ passwd
Changing password for bcavi
(current) Unix password:******
New UNIX password:*******
Retype new UNIX password:*******
passwd: all authentication tokens updated successfully
$
Communication Facilities
It is an important features of multi user operating system. When one user can send message to
another user then we say operating provides communications. Unix provides communication facility in
two ways.
i) Send to user who is currently working.
ii) Send message to who or may not be working on the system currently.
Command are:
i) write
ii) mesg
iii) wall
write:- Allows two logged-in users to have an interactive chat session with each other.
syntax
write user-name //user-name: name of the user whom you want to send message
mesg : Allows/disallows „write‟ or „talk‟ session to display terminal. It control write access to your
terminal
syntax
mesg [y/n]
Example
$ mesg y Allows „write‟ or „talk‟
$ mesg n Doesn‟t allows „write‟ or „talk
wall :- Writes a message to all the users that are currently logged in. This command is typically used
by the system administrator to notify users that the system will be coming down shortly for
maintenance or system updates.
Example:
$ wall “PLEASE LOG OFF!!! SYSTEM GOING DOWN FOR MAINTENANCE.”
Files and Directories
Unix Architecture/ Structure of UNIX
Unix operating System is not a single program. It is a collection of programs. The inner most part is
consist of hardware. Kernel directly deals with hardware and user interacts with shell, which in turn
interacts with Kernel to run a program or access system resources.
Components of Linux/ UNIX
1. Shell
2. Kernel
3. Commands and Utilities
4. File System
Shell
The Shell is the interacts with the user and act as command interpreter for the command and input by
the user. It has a set of command, which can be directly executed by the user. It contains a
programming language, which enables the users to write shell script on their own. It is actually the
interface between the user from the knowledge of kernel function. It also has a programming
capability of its own. C Shell, Bourne Shell and Korn Shell are most famous shells which are available
with most of the Unix variants. The shell program usually stored in a file called „sh‟.
Kernel
The kernel is the heart of the system. A collection of program mostly written communicates with the
hardware directly. It controls function like memory management, task scheduling, file management,
input output services, date & time services etc. There is only one kernel for any system. It is that part
of the Unix system that is bootable. It manages the system resources, allocates time between user
and processor decides process priority and performs all the other task which we would not like to
bother. The Kernel program is usually stored in a file called “UNIX”
Commands and Utilities: There are various command and utilities which you would use in your day
to day activities. cp, mv, cat and grep etc. are few examples of commands and utilities. There are
over 250 standard commands plus numerous others provided through 3rd party software. All the
commands come along with various optional options.
File System(Unix File)
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.
A Unix file is a storehouse of information. It is simply a sequence of characters. A file contains exactly
those bytes that we put into it whether it represents a source program, other text or executed code. A
file neither contains its size nor its attributes. Although every thing is treated as a file by Unix. It is
necessary to divide these files into three categories.
1. Ordinary files
2. Directory files
3. Device files.
Ordinary files
This is the traditional definition of a file. It consists of a stream of data resident on some permanent
magnetic media. We can put any thing we want into this type of files. This include all data, source
programs, object & executable code all Unix programs as well as any files created by users.
Commands like cat, ls, pwd etc are treated as ordinary files.
Directory files
A directory can be defined as a storehouse where other programs and sub-directories reside. A
directory contains no-data, but keeps an account of all the files and sub-directories that it contains.
The Linux/Unix file system is organized with a number of such directories and sub-directories and we
can also create them as and when we need. A directory file contains two fields the name of a file and
a pointer to a separate disk area, which contains the files attributes (i.e. contains file name and inode
number, the files or all files in the directory). Each file in a directory occupies 16 bytes in directory 14
for filename and 2 for inodes.
Device file
A file that is used to access a device such as disks, printers, tapes, floppy etc. The device file is
special in the sense that any output directed to it will be reflected onto the respective I/O (input/
output) devices associated with the file name.
Thus, when we issue a command to print a file, we are really directly the file‟s output to the file
associated with the printer.
Structure of the file system
Root ( / )

bin dev etc mnt temp usr

bin kumar Sharm

files prog Sharm

Fig : Linux/ Unix file system files

All files in Unix are “related” to one another. The file system in Unix is a collection of all the related
files ( ordinary, directory and device files) organized in a hierarchical ( an inverted tree ) structure.
The implicit feature in every Linux/Unix file system is that there is a supreme, which serves as the
reference point for all files. This top is called root, but is represented by a / ( front slash).
Root is actually a directory file and it has a number of sub-directories ( or branch) under it. These sub-
directory in turn, have more sub-directories other files(“ Leaves”) under them.
For instance temp & usr are two directories directly under root, while bin & kumar are sub-directories
under usr.
Note that it is possible for directories to have the same name. Every file, apart from root, must have a
parent, and it should be possible to trace the ultimate parentage of a file to root. Thus the usr
directory is the parent of kumar while root is the parent of usr & the grand parent of kumar. Once the
relationship between various files is established in this manner, Unix provides a simple mechanism of
accessing a file.
The login directory Kumar can also be specified as /usr/kumar. It is called a pathname consist of a
sequence of directory name, separated by /‟s then it indicated that the file is location must be
determined with respect to root.
Such pathname are called absolute pathname when we have more than one / in a pathname for each
such / we have to level in the file system.
A collection of files stored on secondary storage device is called as file system. Linux/Unix creates a
file system on the disk & store file. A physical view of file system is a collection of blocks, where each
block is a multiple of 1024. A file system is further divided into four areas.

Boot Block Super Block I node list Data area

1. Boot Block - This is the first block in the file system. It contains code to load operating system.
2. Super block - Contains information relating to file system. It has number of blocks, number of
free block etc in the file system.
3. I-Node List – Each file in Unix has an I-node. I-node stand for information node. I-node of file
contains the following information
 The location of the item's contents on the disk, if any
 The item's type (e.g., file, directory, symbolic link)
 The item's size, in bytes, if applicable
 The time the file's inode was last modified (the ctime)
 The time the file's contents were last modified (the mtime)
 The time the file was last accessed (the atime) for read ( ), exec ( ), etc
 A reference count: the number of names the file has
 The file's owner (a UID)
 The file's group (a GID)
 The file's mode bits (also called file permissions or permission bits)
Each I-nodes in the list has a number called as I-nodes number. When Unix deal with a file, first
gets I-node number then file & then it will get the information regarding the file.
4. Data Area – Area where the data of file is actually stored. Unix first accesses I-nodes of file
and then it comes to know about the address of blocks in data area. Then it will be data from
these blocks.
File naming conventions(Filenames in UNIX)
On a UNIX system, a filename can consist of up to 255 characters. Files may or may not have
extensions and can consist of practically any ASCII character except the / and the Null character. You
are permitted to use control characters or other nonprintable characters in a filename. However, you
should avoid using these characters while naming a file. It is recommended that only the following
characters be used in filenames:
Alphabets and numerals.
The period (.), hyphen (-) and underscore (_).
UNIX imposes no restrictions on the extension. In all cases, it is the application that imposes that
restriction. Eg. A C Compiler expects C program filenames to end with .c, Oracle requires SQL scripts
to have .sql extension.
A file can have as many dots embedded in its name. A filename can also begin with or end with a dot.
UNIX is case sensitive; cap01, Chap01 and CHAP01 are three different filenames that can coexist in
the same directory.
The names in a directory are called filenames. The only two characters that cannot appear in a
filename are the slash character ( / ) and the null character. The slash separates the filenames that
form a pathname and the null character terminates a pathname.
Two filenames are automatically created whenever a new directory is created: . (called dot) and . .
(called dot-dot). Dot refers to the current directory and dot-dot refers to the parent directory.
Unix Directories:
A directory is a file whose sole job is to store file names and related information. All files whether
ordinary, special, or directory, are contained in directories.
UNIX uses a hierarchical structure for organizing files and directories. This structure is often referred
to as a directory tree . The tree has a single root node, the slash character ( /), and all other
directories are contained below it.
Home Directory:
The directory in which you find yourself when you first login is called your home directory. You will be
doing much of your work in your home directory and subdirectories that you'll be creating to organize
your files.
You can go in your home directory anytime using the following command:
$cd ~
Here ~ indicates home directory. If you want to go in any other user's home directory then use the
following command:
$cd ~username
To go in your last directory you can use following command:
$cd -
Absolute/Relative Pathnames:
Directories are arranged in a hierarchy with root (/) at the top. The position of any file within the
hierarchy is described by its pathname.
Elements of a pathname are separated by a /. A pathname is absolute if it is described in relation to
root, so absolute pathnames always begin with a /.
These are some example of absolute filenames.
/etc/passwd
/users/abc/xyz/notes
/dev/rdsk/OS
A pathname can also be relative to your current working directory. Relative pathnames never begin
with /. Relative to user „abc' home directory, some pathnames might look like this:
xyz/notes
personal/res
To determine where you are within the file-system hierarchy at any time, enter the command pwd to
print the current working directory:
$pwd
/user0/home/abc
Basic commands for working with Directories
pwd
Print the present working directory. At any time we can determine where we are in the file system
hierarchy with the pwd, print working directory command.
Syntax: pwd [Option]
Option
-L display the logical current working directory.
-P display the physical current working directory (all symbolic links resolved)
Example:
$ pwd
cd
Change directory. We can change to a new directory with the cd, change directory, command. cd will
accept both absolute and relative path names.
Syntax: cd directory-name
Example: Change working directory to dir1
$ cd dir1
cd: Changes the current location.
cd.. To go one level back
cd../.. To go two levels back
cd To change user‟s home directory.
Mkdir
Creates a directory/ make a directory
Syntax: mkdir [option] <Directory-name>
Option
-m (mode) set the file permission bits of the final created directory to the specified mode.
Example
$mkdir xyz

To create multiple directories:


$ mkdir dir1 dir2 dir3 -----------------dirn

The system may refuse to create a directory due to the following reasons:
1. The directory already exists.
2. There may be an ordinary file by the same name in the current directory.
3. The permissions set for the current directory don‟t permit the creation of files and directories by the
user.

Rmdir
Remove a directory. A directory needs to be empty before you can remove it. If it‟s not, we need to
remove the files first. Also, we can‟t remove a directory if it is our present working directory; we must
first change out of that directory.
Syntax: rmdir [option] directory-name
Option
-p remove directory and its ancestors
-v output a diagnostic for every directory processed.

$ rmdir dir1
ls
Displays the contents of a directory/ list directory contents. The command to list your directories and
files is ls. With options it can provide information about the size, type of file, permissions, dates of file
creation, change and access.
Syntax
$ls [options]
Options
When no argument is used, the listing will be of the current directory.
-a Lists all files, including those beginning with a dot (.).
-d Lists only names of directories, not the files in the directory
-u Sorts filenames by last access time
-t Sorts filenames by last modification time
-i Displays inode number
-l Long listing:
Meta Character and Wild Card Character
Some special characters, wild card characters, or Meta characters may be used to specify multiple
files-names. These are used to match filenames or parts of file-names
* This character is used to indicate any character(s).
Example:-
$ ls a* Displaying files start with „a‟.
$ ls i* Start with „I‟
$ ls *g list out end with „g‟ only
$ rm i* removes start with i

? this character replaces any one character in filename or It matches any single character in the
given file.
Example
$ ls ? Display single character files.
$ ls ?? Two character files
$ ls a??? list four character files but first one is „a‟.
$ rm ?? Removes two character files.
[] These are used to specify a range of characters. It matches any single characters in the given
list.
Example
$ ls [aeiou] Displays given matching character files.
$ ls [aeiou] * Displays start with a,e,I,o,u files.
$ rm [aeiou] * Removing start with a,e,I,o,u
$ ls [a-f]* Displays start with a,b,c,d,e,f
$ ls [a-f, o-v] * Display start with a-e & o-v
$ rm [a-f] * Removes a-f

Unix File Permission:


File ownership is an important component of UNIX that provides a secure method for storing files.
Every file in UNIX has the following attributes:
 Owner permissions: The owner's permissions determine what actions the owner of the file
can perform on the file.
 Group permissions: The group's permissions determine what actions a user, who is a
member of the group that a file belongs to, can perform on the file.
 Other (world) permissions: The permissions for others indicate what action all other users
can perform on the file.
The Permission Indicators:
While using ls -l command it displays various information related to file permission as follows:
$ls -l /home/bcavi
-rwxr-xr-- 1 bcavi users 1024 Jan 20 16:10 myfile
drwxr-xr--- 1 bcavi users 1024 Jan 20 16:20 mydir
Here first column represents different access mode ie. permission associated with a file or directory.
The permissions are broken into groups of threes, and each position in the group denotes a specific
permission, in this order: read (r), write (w), execute (x):
 The first three characters (2-4) represent the permissions for the file's owner. For example -
rwxr-xr-- represents that onwer has read (r), write (w) and execute (x) permission.
 The second group of three characters (5-7) consists of the permissions for the group to which
the file belongs. For example -rwxr-xr-- represents that group has read (r) and execute (x)
permission but no write permission.
 The last group of three characters (8-10) represents the permissions for everyone else. For
example -rwxr-xr-- represents that other world has read (r) only permission.
File Access Modes: The permissions of a file are the first line of defense in the security of a Unix
system. The basic building blocks of Unix permissions are the read, write, and execute permissions,
which are described below:
1. Read: Grants the capability to read ie. view the contents of the file.
2. Write: Grants the capability to modify, or remove the content of the file.
3. Execute: User with execute permissions can run a file as a program.
Directory Access Modes:
Directory access modes are listed and organized in the same manner as any other file. There are a
few differences that need to be mentioned:
1. Read: Access to a directory means that the user can read the contents. The user can look at
the filenames inside the directory.
2. Write: Access means that the user can add or delete files to the contents of the directory.
3. Execute: Executing a directory doesn't really make a lot of sense so think of this as a traverse
permission. A user must have execute access to the bin directory in order to execute ls
or cd command.
Changing Permissions:
To change file or directory permissions, the chmod (change mode) command is used. File access
permissions can be changed in two ways:-
i) Symbolic mode
ii) Absolute mode.
Using chmod in Symbolic Mode:
The easiest way for a beginner to modify file or directory permissions is to use the symbolic mode.
The symbolic mode consists of three parts, who is affected, the operators indicating action taken, and
the permission.
Syntax
$ chmod [ugo] [+/-][rwx] [file-name]
Example
$ chmod +x aa this change file permissions on file aa for all users
Chmod operator Description
+ Adds the designated permission(s) to a file or directory.
- Remove the designated permission(s) to a file or directory.
Using chmod with Absolute Permissions:
The second way to modify permissions with the chmod command is to use a number to specify each
set of permissions for the file. In the absolute mode octal numbers are used to represent the three
kinds of access permissions. The octal values are:
4 read permission
2 write permission
1 execute permission
By combining the 3 types of permissions and three types of user, we can come up with a total of nine
sets of permissions.
1. read, write, execute permission for the owner.
2. read, write, execute permission for the group.
3. read, write, execute permission for the public (other).
These nine permission are usually written:
rwx rwx rwx
Owner Permission Group Permission public/other Permission
The nine permission or protections are collectively known as the „ mode‟ of the file or directory, and
can be changed with the chmod command.
Suppose
r_ _r_ _ r _ _
A file with this mode can be read by owner, the group, and the public.
It protected from being written ( modified) or executed by any body, the public, the group or the
owner.
Owner Group Others/Public
r w x r w x r w x

4 4 4

2 2 2

1 1 1

For example rw_ r__r__


420400 400
6 4 4
The owner can read and write the file or directory every body can only read it.
Command is
$ chmod 644 file-name
Changing Owners and Groups:
While creating an account on Unix, it assigns a owner ID and a group ID to each user. All the
permissions mentioned above are also assigned based on Owner and Groups. Two commands are
available to change the owner and the group of files:
1. chown: The chown command stands for "change owner" and is used to change the owner of a file.
2. chgrp: The chgrp command stands for "change group" and is used to change the group of a file.
chown (Changing Ownership):
The chown (change owner) command is used to change the individual ownership of a file. The
command takes a file(s) as source files and the login id of another user as the target.
Syntax
$ chown [user-id] [file-name]
User-id The value of user can be either the name of a user on the system or the user id (uid) of
a user on the system.
Example:
$ chown xyz testfile

chrgp (Changing Group Ownership):


The chrgp command changes the group ownership of a file.
Syntax:
$ chgrp [group-id] file-name]
Group-id The value of group can be the name of a group on the system or the group ID (GID) of a
group on the system.
Example:
$ chgrp special testfile

You might also like