SlideShare a Scribd company logo
UNIX Operating Systems
and
Commands
Introduction
• Operating System:
 It acts as an interface between the user and
system.
 a system that manages the resources of a
computer.
• Resources:
 CPUs, Memory, I/O devices, Network etc..
Unix Architecture
 Hardware
 Kernel
 Shell
hardware
kernel
sh who
date
ed
wc
grep
as
nroff
ld
cpp
Other apps
Kernel
• Three major tasks of kernel:
 Process Management
 Device Management
 File Management
Shell
 The shell acts as an interface between
the user and the kernel
 A shell is an environment in which we
can run our commands, it is also called
as a command-line interpreter
Basic Linux Commands
• File Handling
• Text Processing
• System Administration
• Process Management
• Archival
• Network
• File Systems
• Advanced Commands
Files
 Everything in unix is considered as a file,
including the physical devices like flash
device, network cards etc..
 Logical collection of files is called as file
system or Unix file system(UFS).
 A UFS(unix file system) contains both inode
and contents of the file.
 Every file as a unique number to identify, this
number is called as an inode number.
Files…..
 We can classify files into 3
1. Ordinary Files
• Text File
• Binary File
2. Device Files
3. Directory Files / Special Files
Unix File Attributes
 File Permissions
1. Read: ‘r’ If you have read permission of a file, you
can see the contents of the file.
2. Write: ‘w’ If you have write permission of a file,
you can change the file. This means you can add to
a file, or overwrite a file. You can empty a file.
3. Execute: ‘x’ If the file has execute permission, then
you can ask the operating system to run the file as
if it were a program. If it's a binary file/program,
you can execute it like any other program.
File Attribute…
1. File type/File Permissions
2. Link
3. Owner
4. Group
5. Size
6. Last Modified Time
7. File Name
NOTE: ‘ls –l’ command lists the files in
the directory along with their attributes.
1. File type/ File permissions
 The first field of ls –l command gives the details of file type
and file permission
 This field as 10 characters.
_|_ _ _|_ _ _|_ _ _
FILE TYPE
FILE PERMISSIONS
1. FILE TYPE
the first character of the first field defines the type of the
file.
‘d’ – specifies that the file is a ‘directory file’ or a ‘special file’
‘-’ – spefies that a file is not a directory file.
 File Permissions:
Unix has three categories of file permission.
_ _ _ | _ _ _ | _ _ _
r w x r w x r w x
USER (U)
GROUP (G)
OTHER (O)
U G O
To change file Permission
 ‘chmod’ command is used to change the permissions of
the file.
USAGE: chmod [options] mode[,mode] file1 [file2 ...]
 Unix allows the user to specify modes in two ways.
1. Absolute
2. Relative
1. Absolute:
in this we use a series of 3 octal numbers to specify
the permission of a file.
Ex: chmod 501 demo.txt, chmod 777 demo.txt
 | rwx | 111 | 7 | Read, write and execute |
 | rw- | 110 | 6 | Read, write |
 | r-x | 101 | 5 | Read, and execute |
 | r-- | 100 | 4 | Read, |
 | -wx | 011 | 3 | Write and execute |
 | -w- | 010 | 2 | Write |
 | --x | 001 | 1 | Execute |
 | --- | 000 | 0 | no permissions |
+----------------------------------------------------+
 RELATIVE
In this mode ‘=‘ , ‘+’, ‘-’ operators are used to
assign, give and remove permissions.
On the LHS specify the category u,g,o,a.
On the RHS specify the permission r,w,x.
Ex: chmod u+r demo.txt
chmod u+rw demo.txt
chmod ug+rwx demo.txt
chmod a+rwx demo.txt
chmod u+rw,g+x demo.txt
INODE
 Is a data structure and it contains following details of the
file:
1. Mode/permission (protection)
2. Owner ID
3. Group ID
4. Size of file
5. Number of hard links to the file
6. Time last accessed
7. Time last modified
8. Time inode last modified
 ‘-i’ option along with ls command is used to see the
inode number of a file.
2. Link
 A link in UNIX is a pointer to a file. Like pointers in
any programming languages, links in UNIX are
pointers pointing to a file or a directory . Creating
links is a kind of shortcuts to access a file.
 It is similar to creating multiple names of the file to
access from different directories.
 The two different types of links in UNIX are:
1. Soft Links or Symbolic Links
2. Hard links
ln Command
 This command is used to create link for a file.
USAGE: ln [option] target link_name
ex: ln file1 file2
 ‘-s’ option is used to provide a soft link.
USAGE: ln –s target_file Link_name
ex: ln –s file1 file3
Hard link
 A hard link is an additional name for an existing file
on Unix-like operating systems. Any number of hard
links can be created for a file, and thus any number of
names, can be created for any file
 The inode of the hard linked file remains same as the
original file.
 On deleting the original file, hard linked file can still be
accessed.
 By giving the hard link the link count of the file will
increase.
 Hard links do not need any extra data memory to save
since it uses links
 Can be created only on files, not on directories.
Soft/Symbolic Link
 In computing, a symbolic link (soft link) is the nickname for
any file that contains a reference to another file or directory in
the form of an absolute or relative path and that affects
pathname resolution.
 Soft link can be created for non exiting file.
 oft link has a different inode number than the original file
 On deleting the original file, soft link cannot be accessed.
 Soft link needs extra memory to store the original file name as
its data.
 Access to the file is slower due to the overhead to access file.
3. Owner
 Gives the name of the owner of the file.
 We can change the owner of the file using the
command ‘chown’.
usage: chown owner file
4.Group
 Gives the name of the group a file belong to.
 We can change the group of the file using the
command ‘chgrp’.
Usage: chgrp group file
Sources to learn commands??
(man)
λ
Primary – man(manual) pages.1
2
man <command> ­ shows all information about the
command ex: man ls
<command> ­­­­help ­ shows the available options
for that command ex: ls ­­help
File Handling
commands
•
•
mkdir – is used to create directories
Usage: mkdir [OPTION]
DIRECTORY...
ex: mkdir demo
ls – is used to list all the files and
subdirectories
of the current directory.
Usage: ls [OPTION]... [FILE]...
eg. ls, ls ­l, ls ­l demo
File
Handling(contd...)
• pwd -­ print name of current working directory
Usage: pwd
• cd ­ change directories
Usage: cd [DIRECTORY]
eg. cd demo
Note: the Directory can be a relative or absolute path
of Directory
cp – copy files and directories
Usage: cp [OPTION]... SOURCE DEST
Examples:
1. cp file1 file2
cp a.txt b.txt
2. cp file 1 file2…. filen directory
cp file1 file2 /home/user/demo
mv – this command is used to move a file
from one directory to another
It is also used to rename a file.
Usage: mv [OPTION]... SOURCE DEST
eg. mv source.txt target_dir
mv old.txt new.txt
rm ­ remove files or directories
Usage: rm [OPTION]... FILE... eg. rm file1.txt , rm ­rf
some_dir
• find – search for files in a directory
hierarchy
Usage: find [OPTION] [path]
[action]
eg. 1. find file1.txt,
2. find ­­name file1.txt
• history – prints recently used commands
Usage: history
TO create an USER
 ‘addusr’ command is used to create a user.
 To create a new user the user should be logged
in as a root­user.
usage: addusr user_name
TO switch User
 ‘su’ command is used to switch from one user to another
Usage: su User_name
 It asks for the password to login.
 ‘exit’ command is used to come out of the logged in
user.
How to login as root ?
 ‘sudo su’ command is used to login as a root-user.
usage: sudo su
 It will ask for the password.
 The user should have permission to login as the root-user.
 All the users having root permissions are stored in a file
‘visudo’.
To remove User
 ‘delusr’ command is used to delete a user.
usage: delusr user-name
 You should be log-in as a root-user to delete an
user.
Basic Regular Expression
 The BRE a{1,2} matches a{1,2} literally,
while a{1,2} matches a or aa.
 As {,},+,?,(,),.. Are treated as a normal
symbols and we have to use a ‘’ to give
special meaning to them.
 As ?,+,.. Are not supported by POSIX
(Portable Operating system Interface for Unix)
BRE.
 We use grep command for BRE.
Extended Regular Expression
 The quantifiers ?, +, {n}, {n,m} and {n,} repea
t the preceding token zero or once, once or
more, n times, between n and m times, and n or
more times, respectively.
 These above quantifiers are supported by
POSIX ERE and we use egrep or grep –E
command.
Metacharacters
 ^ (Caret)=match expression at the start of a line, as in
^A.
 $ (Dollar)=match expression at the end of a line, as in
A$.
  (Back Slash)=turn off the special meaning of the next
character, as in ^.
 [ ] (Brackets)=match any one of the enclosed characters,
as in [aeiou]. Use Hyphen "-" for a range, as in [0-9].
 [^ ]=match any one character except those enclosed in
[ ], as in [^0-9].
 . (Period)=match a single character of any
value, except end of line.
 * (Asterisk)=match zero or more of the
preceding character or expression.
 {x,y}=match x to y occurrences of the
preceding.
 {x}=match exactly x occurrences of the
preceding.
 {x,}=match x or more occurrences of
the preceding.
Searching for a pattern in UINIX
 Unix has a special family of commands for handling
search requirements.
 The main member of this family is the grep
command.
GREP: (Global Regular Expression Parser)
 It scans its input for a pattern and displays lines
containing the pattern.
Examples
 grep '^From: ' demo.txt
 grep '[a-zA-Z]'{any line with at least one
letter}
 grep '[^a-zA-Z0-9]{anything not a letter or
number}
 grep '[0-9]{3}-[0-9]{4}'{999-9999, like
phone numbers}
 grep '^.$'{lines with exactly one character}
 grep '"smug"'{'smug' within double
quotes}
 grep '"*smug"*'{'smug', with or without
quotes}
 grep '^.'{any line that starts with a
Period "."}
 grep '^.[a-z][a-z]'{line start with "." and
2 letters}

More Related Content

PPTX
Linux basics
Shagun Rathore
 
PPTX
Linux file system
Md. Tanvir Hossain
 
PPTX
linux vs window
Khaliq ur Rehman
 
PDF
Shell scripting
Manav Prasad
 
PPTX
Introduction to Linux
Harish R
 
ODP
Linux commands
Balakumaran Arunachalam
 
PPTX
Linux commands
penetration Tester
 
PPT
Linux Commands
Ramasubbu .P
 
Linux basics
Shagun Rathore
 
Linux file system
Md. Tanvir Hossain
 
linux vs window
Khaliq ur Rehman
 
Shell scripting
Manav Prasad
 
Introduction to Linux
Harish R
 
Linux commands
Balakumaran Arunachalam
 
Linux commands
penetration Tester
 
Linux Commands
Ramasubbu .P
 

What's hot (20)

PPT
Linux basics
Santosh Khadsare
 
PDF
Course 102: Lecture 5: File Handling Internals
Ahmed El-Arabawy
 
PPT
Linux file system
Midaga Mengistu
 
PPTX
Linux fundamentals
Deepak Upadhyay
 
PDF
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
PPTX
Bash shell scripting
VIKAS TIWARI
 
PDF
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Ahmed El-Arabawy
 
PPT
Linux command ppt
kalyanineve
 
PDF
Linux Porting
Anil Kumar Pugalia
 
PPTX
Linux fundamentals
Raghu nath
 
PPTX
Topic #3 of outline Server Environment.pptx
AyeCS11
 
PDF
Lesson 2 Understanding Linux File System
Sadia Bashir
 
PDF
Ubuntu – Linux Useful Commands
University of Technology
 
PPT
Linux
Kevin James
 
PDF
Architecture Of The Linux Kernel
guest547d74
 
PPTX
UNIX Operating System ppt
OECLIB Odisha Electronics Control Library
 
PPTX
Operating systems unix
Achu dhan
 
PDF
Linux File System
Anil Kumar Pugalia
 
PPT
Shell Scripting in Linux
Anu Chaudhry
 
PPTX
Introduction 2 linux
Papu Kumar
 
Linux basics
Santosh Khadsare
 
Course 102: Lecture 5: File Handling Internals
Ahmed El-Arabawy
 
Linux file system
Midaga Mengistu
 
Linux fundamentals
Deepak Upadhyay
 
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Bash shell scripting
VIKAS TIWARI
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Ahmed El-Arabawy
 
Linux command ppt
kalyanineve
 
Linux Porting
Anil Kumar Pugalia
 
Linux fundamentals
Raghu nath
 
Topic #3 of outline Server Environment.pptx
AyeCS11
 
Lesson 2 Understanding Linux File System
Sadia Bashir
 
Ubuntu – Linux Useful Commands
University of Technology
 
Linux
Kevin James
 
Architecture Of The Linux Kernel
guest547d74
 
Operating systems unix
Achu dhan
 
Linux File System
Anil Kumar Pugalia
 
Shell Scripting in Linux
Anu Chaudhry
 
Introduction 2 linux
Papu Kumar
 
Ad

Viewers also liked (20)

PPT
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Selenium Webdriver
Qspiders - Software Testing Training Institute
 
PPTX
Unix
Erm78
 
ODP
intro unix/linux 02
duquoi
 
PPT
Unix(introduction)
meashi
 
PDF
Unix Command Line Productivity Tips
Keith Bennett
 
PPTX
Unix OS & Commands
Mohit Belwal
 
PPT
UNIX and Linux - an introduction by Mathias Homann
Mathias Homann
 
PDF
Linux intro 3 grep + Unix piping
Giovanni Marco Dall'Olio
 
PDF
Unix - An Introduction
Deepanshu Gahlaut
 
PPTX
UNIX Operating System
Unless Yuriko
 
PPT
Unix memory management
Tech_MX
 
PPT
Basic Unix
Rajesh Kumar
 
PPT
Unix/Linux Basic Commands and Shell Script
sbmguys
 
PPT
Unix command-line tools
Eric Wilson
 
PPTX
Unix Operating System
subhsikha
 
PPTX
UNIX/Linux training
Michael Olafusi
 
PPT
Practical Example of grep command in unix
Javin Paul
 
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
QSpiders - Selenium Webdriver
Qspiders - Software Testing Training Institute
 
Unix
Erm78
 
intro unix/linux 02
duquoi
 
Unix(introduction)
meashi
 
Unix Command Line Productivity Tips
Keith Bennett
 
Unix OS & Commands
Mohit Belwal
 
UNIX and Linux - an introduction by Mathias Homann
Mathias Homann
 
Linux intro 3 grep + Unix piping
Giovanni Marco Dall'Olio
 
Unix - An Introduction
Deepanshu Gahlaut
 
UNIX Operating System
Unless Yuriko
 
Unix memory management
Tech_MX
 
Basic Unix
Rajesh Kumar
 
Unix/Linux Basic Commands and Shell Script
sbmguys
 
Unix command-line tools
Eric Wilson
 
Unix Operating System
subhsikha
 
UNIX/Linux training
Michael Olafusi
 
Practical Example of grep command in unix
Javin Paul
 
Ad

Similar to QSpiders - Unix Operating Systems and Commands (20)

PPTX
Commands and shell programming (3)
christ university
 
PPTX
Unix Shell Script - 2 Days Session.pptx
Rajesh Kumar
 
DOC
58518522 study-aix
homeworkping3
 
PDF
basic-unix.pdf
OmprakashNath2
 
PPSX
Unix environment [autosaved]
Er Mittinpreet Singh
 
PPTX
Linux Commands all presentation file .pptx
AshutoshPrajapati30
 
PPT
Karkha unix shell scritping
chockit88
 
PPTX
Ai module
KUMARRISHAV29
 
PDF
Presentation aix basic
xKinAnx
 
PPTX
Chapter 2 unix system commands
LukasJohnny
 
PPT
LINUX
ARJUN
 
PPTX
Unix training session 1
Anil Kumar Kapil,PMP®
 
PPTX
Linux System commands Essentialsand Basics.pptx
mba1130feb2024
 
PPT
Unix tutorial-08
Tushar Jain
 
PPT
linux-commands.ppt
ArliPutraPratama1
 
PPT
linux-commands.ppt
MeghrajPatil11
 
PPT
linux-commands.ppt
ArliPutraPratama
 
PPT
linux-commands.ppt
saubhagya ranjan
 
PPT
linux-commands.ppt
AbhishekKumarSrivast36
 
PPT
Linux commands
VenkatakrishnaAdari1
 
Commands and shell programming (3)
christ university
 
Unix Shell Script - 2 Days Session.pptx
Rajesh Kumar
 
58518522 study-aix
homeworkping3
 
basic-unix.pdf
OmprakashNath2
 
Unix environment [autosaved]
Er Mittinpreet Singh
 
Linux Commands all presentation file .pptx
AshutoshPrajapati30
 
Karkha unix shell scritping
chockit88
 
Ai module
KUMARRISHAV29
 
Presentation aix basic
xKinAnx
 
Chapter 2 unix system commands
LukasJohnny
 
LINUX
ARJUN
 
Unix training session 1
Anil Kumar Kapil,PMP®
 
Linux System commands Essentialsand Basics.pptx
mba1130feb2024
 
Unix tutorial-08
Tushar Jain
 
linux-commands.ppt
ArliPutraPratama1
 
linux-commands.ppt
MeghrajPatil11
 
linux-commands.ppt
ArliPutraPratama
 
linux-commands.ppt
saubhagya ranjan
 
linux-commands.ppt
AbhishekKumarSrivast36
 
Linux commands
VenkatakrishnaAdari1
 

More from Qspiders - Software Testing Training Institute (20)

PPS
QSpiders - Variable Length-Subnet-Masks
Qspiders - Software Testing Training Institute
 
PPS
QSpiders - Upper layer-protocols
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Day1 Network Basics
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Aptitude Assignments
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - SQL (Data Base)
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Chapter 7 Debugging
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Chapter 4 Checkpoints
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Simple Recording and Configuration of recording options for HP Loa...
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Wonderlic Sample Question
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Chapter- 3 Synchronization point
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Presentation JMeter
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Memory (JVM architecture)
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Simple replay and run time settings Loadrunner
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Major difference
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Introduction to HP Load Runner
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Interacting with My SQL Database
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Server Architecture
Qspiders - Software Testing Training Institute
 
PPTX
QSpiders - Installation and Brief Dose of Load Runner
Qspiders - Software Testing Training Institute
 
QSpiders - Variable Length-Subnet-Masks
Qspiders - Software Testing Training Institute
 
QSpiders - Upper layer-protocols
Qspiders - Software Testing Training Institute
 
QSpiders - Day1 Network Basics
Qspiders - Software Testing Training Institute
 
QSpiders - Aptitude Assignments
Qspiders - Software Testing Training Institute
 
QSpiders - Chapter 7 Debugging
Qspiders - Software Testing Training Institute
 
QSpiders - Chapter 4 Checkpoints
Qspiders - Software Testing Training Institute
 
QSpiders - Simple Recording and Configuration of recording options for HP Loa...
Qspiders - Software Testing Training Institute
 
QSpiders - Wonderlic Sample Question
Qspiders - Software Testing Training Institute
 
QSpiders - Chapter- 3 Synchronization point
Qspiders - Software Testing Training Institute
 
QSpiders - Presentation JMeter
Qspiders - Software Testing Training Institute
 
QSpiders - Memory (JVM architecture)
Qspiders - Software Testing Training Institute
 
QSpiders - Jdk Jvm Jre and Jit
Qspiders - Software Testing Training Institute
 
QSpiders - Simple replay and run time settings Loadrunner
Qspiders - Software Testing Training Institute
 
QSpiders - Introduction to HP Load Runner
Qspiders - Software Testing Training Institute
 
QSpiders - Interacting with My SQL Database
Qspiders - Software Testing Training Institute
 
QSpiders - Server Architecture
Qspiders - Software Testing Training Institute
 
QSpiders - Installation and Brief Dose of Load Runner
Qspiders - Software Testing Training Institute
 

Recently uploaded (20)

PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
PPTX
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
PPTX
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
PPTX
Strengthening open access through collaboration: building connections with OP...
Jisc
 
PDF
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PDF
Wings of Fire Book by Dr. A.P.J Abdul Kalam Full PDF
hetalvaishnav93
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
academysrusti114
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Arihant Class 10 All in One Maths full pdf
sajal kumar
 
ACUTE NASOPHARYNGITIS. pptx
AneetaSharma15
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
NOI Hackathon - Summer Edition - GreenThumber.pptx
MartinaBurlando1
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
vedic maths in python:unleasing ancient wisdom with modern code
mistrymuskan14
 
IMMUNIZATION PROGRAMME pptx
AneetaSharma15
 
Strengthening open access through collaboration: building connections with OP...
Jisc
 
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
Sandeep Swamy
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Wings of Fire Book by Dr. A.P.J Abdul Kalam Full PDF
hetalvaishnav93
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 

QSpiders - Unix Operating Systems and Commands

  • 2. Introduction • Operating System:  It acts as an interface between the user and system.  a system that manages the resources of a computer. • Resources:  CPUs, Memory, I/O devices, Network etc..
  • 3. Unix Architecture  Hardware  Kernel  Shell hardware kernel sh who date ed wc grep as nroff ld cpp Other apps
  • 4. Kernel • Three major tasks of kernel:  Process Management  Device Management  File Management
  • 5. Shell  The shell acts as an interface between the user and the kernel  A shell is an environment in which we can run our commands, it is also called as a command-line interpreter
  • 6. Basic Linux Commands • File Handling • Text Processing • System Administration • Process Management • Archival • Network • File Systems • Advanced Commands
  • 7. Files  Everything in unix is considered as a file, including the physical devices like flash device, network cards etc..  Logical collection of files is called as file system or Unix file system(UFS).  A UFS(unix file system) contains both inode and contents of the file.  Every file as a unique number to identify, this number is called as an inode number.
  • 8. Files…..  We can classify files into 3 1. Ordinary Files • Text File • Binary File 2. Device Files 3. Directory Files / Special Files
  • 9. Unix File Attributes  File Permissions 1. Read: ‘r’ If you have read permission of a file, you can see the contents of the file. 2. Write: ‘w’ If you have write permission of a file, you can change the file. This means you can add to a file, or overwrite a file. You can empty a file. 3. Execute: ‘x’ If the file has execute permission, then you can ask the operating system to run the file as if it were a program. If it's a binary file/program, you can execute it like any other program.
  • 10. File Attribute… 1. File type/File Permissions 2. Link 3. Owner 4. Group 5. Size 6. Last Modified Time 7. File Name NOTE: ‘ls –l’ command lists the files in the directory along with their attributes.
  • 11. 1. File type/ File permissions  The first field of ls –l command gives the details of file type and file permission  This field as 10 characters. _|_ _ _|_ _ _|_ _ _ FILE TYPE FILE PERMISSIONS 1. FILE TYPE the first character of the first field defines the type of the file. ‘d’ – specifies that the file is a ‘directory file’ or a ‘special file’ ‘-’ – spefies that a file is not a directory file.
  • 12.  File Permissions: Unix has three categories of file permission. _ _ _ | _ _ _ | _ _ _ r w x r w x r w x USER (U) GROUP (G) OTHER (O) U G O
  • 13. To change file Permission  ‘chmod’ command is used to change the permissions of the file. USAGE: chmod [options] mode[,mode] file1 [file2 ...]  Unix allows the user to specify modes in two ways. 1. Absolute 2. Relative 1. Absolute: in this we use a series of 3 octal numbers to specify the permission of a file. Ex: chmod 501 demo.txt, chmod 777 demo.txt
  • 14.  | rwx | 111 | 7 | Read, write and execute |  | rw- | 110 | 6 | Read, write |  | r-x | 101 | 5 | Read, and execute |  | r-- | 100 | 4 | Read, |  | -wx | 011 | 3 | Write and execute |  | -w- | 010 | 2 | Write |  | --x | 001 | 1 | Execute |  | --- | 000 | 0 | no permissions | +----------------------------------------------------+
  • 15.  RELATIVE In this mode ‘=‘ , ‘+’, ‘-’ operators are used to assign, give and remove permissions. On the LHS specify the category u,g,o,a. On the RHS specify the permission r,w,x. Ex: chmod u+r demo.txt chmod u+rw demo.txt chmod ug+rwx demo.txt chmod a+rwx demo.txt chmod u+rw,g+x demo.txt
  • 16. INODE  Is a data structure and it contains following details of the file: 1. Mode/permission (protection) 2. Owner ID 3. Group ID 4. Size of file 5. Number of hard links to the file 6. Time last accessed 7. Time last modified 8. Time inode last modified  ‘-i’ option along with ls command is used to see the inode number of a file.
  • 17. 2. Link  A link in UNIX is a pointer to a file. Like pointers in any programming languages, links in UNIX are pointers pointing to a file or a directory . Creating links is a kind of shortcuts to access a file.  It is similar to creating multiple names of the file to access from different directories.  The two different types of links in UNIX are: 1. Soft Links or Symbolic Links 2. Hard links
  • 18. ln Command  This command is used to create link for a file. USAGE: ln [option] target link_name ex: ln file1 file2  ‘-s’ option is used to provide a soft link. USAGE: ln –s target_file Link_name ex: ln –s file1 file3
  • 19. Hard link  A hard link is an additional name for an existing file on Unix-like operating systems. Any number of hard links can be created for a file, and thus any number of names, can be created for any file  The inode of the hard linked file remains same as the original file.  On deleting the original file, hard linked file can still be accessed.  By giving the hard link the link count of the file will increase.  Hard links do not need any extra data memory to save since it uses links  Can be created only on files, not on directories.
  • 20. Soft/Symbolic Link  In computing, a symbolic link (soft link) is the nickname for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.  Soft link can be created for non exiting file.  oft link has a different inode number than the original file  On deleting the original file, soft link cannot be accessed.  Soft link needs extra memory to store the original file name as its data.  Access to the file is slower due to the overhead to access file.
  • 21. 3. Owner  Gives the name of the owner of the file.  We can change the owner of the file using the command ‘chown’. usage: chown owner file
  • 22. 4.Group  Gives the name of the group a file belong to.  We can change the group of the file using the command ‘chgrp’. Usage: chgrp group file
  • 23. Sources to learn commands?? (man) λ Primary – man(manual) pages.1 2 man <command> ­ shows all information about the command ex: man ls <command> ­­­­help ­ shows the available options for that command ex: ls ­­help
  • 24. File Handling commands • • mkdir – is used to create directories Usage: mkdir [OPTION] DIRECTORY... ex: mkdir demo ls – is used to list all the files and subdirectories of the current directory. Usage: ls [OPTION]... [FILE]... eg. ls, ls ­l, ls ­l demo
  • 25. File Handling(contd...) • pwd -­ print name of current working directory Usage: pwd • cd ­ change directories Usage: cd [DIRECTORY] eg. cd demo Note: the Directory can be a relative or absolute path of Directory
  • 26. cp – copy files and directories Usage: cp [OPTION]... SOURCE DEST Examples: 1. cp file1 file2 cp a.txt b.txt 2. cp file 1 file2…. filen directory cp file1 file2 /home/user/demo
  • 27. mv – this command is used to move a file from one directory to another It is also used to rename a file. Usage: mv [OPTION]... SOURCE DEST eg. mv source.txt target_dir mv old.txt new.txt rm ­ remove files or directories Usage: rm [OPTION]... FILE... eg. rm file1.txt , rm ­rf some_dir
  • 28. • find – search for files in a directory hierarchy Usage: find [OPTION] [path] [action] eg. 1. find file1.txt, 2. find ­­name file1.txt • history – prints recently used commands Usage: history
  • 29. TO create an USER  ‘addusr’ command is used to create a user.  To create a new user the user should be logged in as a root­user. usage: addusr user_name
  • 30. TO switch User  ‘su’ command is used to switch from one user to another Usage: su User_name  It asks for the password to login.  ‘exit’ command is used to come out of the logged in user.
  • 31. How to login as root ?  ‘sudo su’ command is used to login as a root-user. usage: sudo su  It will ask for the password.  The user should have permission to login as the root-user.  All the users having root permissions are stored in a file ‘visudo’.
  • 32. To remove User  ‘delusr’ command is used to delete a user. usage: delusr user-name  You should be log-in as a root-user to delete an user.
  • 33. Basic Regular Expression  The BRE a{1,2} matches a{1,2} literally, while a{1,2} matches a or aa.  As {,},+,?,(,),.. Are treated as a normal symbols and we have to use a ‘’ to give special meaning to them.  As ?,+,.. Are not supported by POSIX (Portable Operating system Interface for Unix) BRE.  We use grep command for BRE.
  • 34. Extended Regular Expression  The quantifiers ?, +, {n}, {n,m} and {n,} repea t the preceding token zero or once, once or more, n times, between n and m times, and n or more times, respectively.  These above quantifiers are supported by POSIX ERE and we use egrep or grep –E command.
  • 35. Metacharacters  ^ (Caret)=match expression at the start of a line, as in ^A.  $ (Dollar)=match expression at the end of a line, as in A$.  (Back Slash)=turn off the special meaning of the next character, as in ^.  [ ] (Brackets)=match any one of the enclosed characters, as in [aeiou]. Use Hyphen "-" for a range, as in [0-9].  [^ ]=match any one character except those enclosed in [ ], as in [^0-9].
  • 36.  . (Period)=match a single character of any value, except end of line.  * (Asterisk)=match zero or more of the preceding character or expression.  {x,y}=match x to y occurrences of the preceding.  {x}=match exactly x occurrences of the preceding.  {x,}=match x or more occurrences of the preceding.
  • 37. Searching for a pattern in UINIX  Unix has a special family of commands for handling search requirements.  The main member of this family is the grep command. GREP: (Global Regular Expression Parser)  It scans its input for a pattern and displays lines containing the pattern.
  • 38. Examples  grep '^From: ' demo.txt  grep '[a-zA-Z]'{any line with at least one letter}  grep '[^a-zA-Z0-9]{anything not a letter or number}  grep '[0-9]{3}-[0-9]{4}'{999-9999, like phone numbers}  grep '^.$'{lines with exactly one character}
  • 39.  grep '"smug"'{'smug' within double quotes}  grep '"*smug"*'{'smug', with or without quotes}  grep '^.'{any line that starts with a Period "."}  grep '^.[a-z][a-z]'{line start with "." and 2 letters}