SlideShare a Scribd company logo
1 of 52
UNIX
Quality Thought Technologies
What is the purpose of the session
1. As a tester why I need Unix knowledge?
2. How Unix knowledge will be helpful to increase my job
opportunities?
3. As a fresher or testing fresher do I need testing
knowledge?
Quality Thought Technologies
What we are not covering
1. This session is not covering Advanced Unix
2. This session is not designed with development
focus
Quality Thought Technologies
How to reach out to me in case of doubts in
Unix
 qtramana@gmail.com
Quality Thought Technologies
UNIX is a CUI operating system.
Operating System:
An operating system can be defined as the software
that controls the H/W resources of the computer
and provides an environment under which programs
can run.
Quality Thought Technologies
Flavors of UNIX:
Aix by IBM
Macos by apple
Red hat linus by red hat s/w
Solaries by sun solaries
Quality Thought Technologies
Features of Unix
The Unix OS offers several features, the important of which
are discussed below.
Multiuser Capability
Multitasking Capability
Communication
Security
Portability
Quality Thought Technologies
Multiuser Capability
Terminal
Terminal
Terminal Terminal
Host
Machine
 Several users can use the same computer
simultaneously i.e. , more than one keyboard and
terminal can be connected to one computer.
 The same data to be shared by all
Quality Thought Technologies
Multitasking Capability
Performing tasks simultaneously rather than sequentially.
A multi tasking operating system allows more than one
program to be running at a time
Quality Thought Technologies
Communication
Communication between different terminals
Quality Thought Technologies
Security
Unix provides 3 levels of security to protect data.
Assigning passwords and login names to individual users.
At file level
File encryption utility.
Quality Thought Technologies
Portability
It can be ported (Transfer from one system to another)
to almost any computer system.
Quality Thought Technologies
Shell
Kernel
Hardware
Architecture of the UNIX operating system
User
Shell:
The shell reads your commands
And interprets them as a requests
And then conveys them to the
kernel which ultimately execute them
Kernel: (Heart of nix)
Which interacts with the actual
H/W In machine language.
File
Management
And Security
Networkin
g
Services
Date and
Time
Services
Input / Output
Services
Signal
Handling
Process
Scheduling
System
Administration
and Accounting
Memory
Management
Functions of Kernel:
It manages files.
Manages Memory.
Scheduling of various programs.
Quality Thought Technologies
The Unix file system
/ (root)
unix bin lib dev usr tmp etc
user1 User2 . . . . bin
unix: Unix kernel itself
Bin: Directory contains executable files
Lib: Directory all the libery functions provided by Unix.
Dev: Directory contains files that controls various I/P,
O/P devices
Bin: Which contains additional Unix commands.
Etc: binary executable files.
Quality Thought Technologies
Basic Commands
logname : It prints the login name of the user (Current user
name)
pwd: It displays the present working directory.
date : it displays system date and time (current date and
time)
who am i: It displays current user name, terminal number,
date and time at which you logged in.
who : To display data about all the users who have logged
into the system currently.
Quality Thought Technologies
Creating Files:
touch: It creates zero byte file.
Syntax: touch filename
Example: touch file1
This creates a file called file1 , the size of the file would be zero
bytes.
Note: touch does not allow you to store anything in a file.
How to create several empty files?
What if you want to store a few lines in a file?
Quality Thought Technologies
cat: to create file and another to display the contents of an
existing file.
Syntax: Cat > filename
Command: cat > test
******
******
******
Ctrl+d
cat >> test -- to append data to the file.
cat> sample1 sample2 > newsample
This would create newsample, which contains contents of sample1
followed by sample2
What if newsample already contains something?
It would be overwritten
cat filename --> to view the contents of an existing file.
cat file1 file2 file3.
Removing files:
Command: rm
rm removes the given file or files supplied to it.
Syntax: rm filename
Ex: rm file1
It removes file1.
rm –i filename  i- interactively
rm file1 file2 file3
It removes 3 files at a time
Quality Thought Technologies
Creating directory:
mkdir: make directory/creates a directory
Syntax: mkdir directory name
Ex: mkdir hyderabad
Creating multiple directories:
mkdir dir1 dir2 dir3
mkdir –p dir1/dir2/dir3/dir4
Creates all the parent directories specified in the given path.
Changing directory:
Syntax: cd directory name
Ex: cd your desired directory name.
Cd  current users home directory
Cd ..  to change into parent directory.
Quality Thought Technologies
Removing directory :
rmdir directory name : to delete a directory but directory
should be empty
rm –r directory name
rm –r dir1 -> recursively (–r) removes all contents of dir1
and also dir1 itself
Quality Thought Technologies
Copy a file:
Syntax: cp source file target file
Command: cp sample1 sample2
This will copy contents of sample1 into a sample2. if sample2
already existed it overwrites.
cp –i sample1 sample2  if sample2 already existed then it asks the
confirmation.
Rename a file:
If you want to rename the file test to sample we would say:
mv test sample
mv command also has the power to rename directories.
mv olddir newdir
Note: moving a file implies removing it from its current location
and copying it at a new location
mv file1 file2 newdir
Quality Thought Technologies
Word count:
Syntax: wc filename
It counts the number of lines, words and characters in
the specified file or files.
Wc –l file1
Wc file1
Wc file1 file2 file3
Wc –lwc file1 fil2
Quality Thought Technologies
Sort:
1.Sort command can be used for sorting the contents of a
file.
2.It can merge multiple sorted files and store the result in
the
specified output file.
3.Sort can display unique lines.
Note: Sorting is done according to ASCII collating sequence.
Syntax: sort filename
Command: Sort myfile
Sorting multiple files:
sort file1 file2 file3
sort –o myresuly file1 file2 file3
sort –u –o result file1 file2 file3
sort –m file1 file2
-m  Merge file1 content with file2.
Quality Thought Technologies
Removing duplicate lines using uniq:
uniq utility compare only adjacent lines, duplicate lines
must be next to each other in the file. To solve this problem you
can use command as follows
$ sort personame | uniq
Quality Thought Technologies
Listing files and directories:
Lists the content of the current or specified directory.
ls
ls –a  to display files and directories including hidden files.
.  stands for current directory
..  parent of the current directory.
Note: These two entries automatically get created in the dir
whenever the dir is created.
Ls –ltr l  it displays files and dir in long format
Ls –l |grep ^d  to display only directories
- ordinary file
Quality Thought Technologies
Permissions:
There are 3 classes of file permissions for the 3 classes of users.
1. Owner/user
2. Group
3. Others
Ls –l
- rwx r- - r- -
Permissions weight
R- read - 4
W- write -2
X- execute -1
Quality Thought Technologies
Changing file permissions:
Chmod to change file/dir permissions.
Chmod 700 filename
Quality Thought Technologies
gzip: This command compresses the given file and replaces it
with the compressed version name
Syntax: gzip filename
gunzip: to unzip compressed file
Syntax: gunzip filename.gz
Quality Thought Technologies
Filter commands:
1.Grep
2.Sort
3.cut
Grep: Globally search a regular expression.
syntax: grep "word-to-find" {file-name}
Command: grep hyderabad sample1
grep will locate all lines for the " hyderabad " pattern and print
all (matched) such line on-screen.
Quality Thought Technologies
grep "." myfile.txt
The above command returns every line of myfile.txt.
Options
-c  it returns only number of matches.
-i  ignores case while searching
-v  returns lines that do not match the test
Quality Thought Technologies
Cut command:
It cuts or pick up a given number of character or fields from the
specified file.
Command: cut –f 2 file1  it displays second filed in file1.
Cut –f 2,4 file1  it displays 2,4th fields in file1.
Here, cut command assumes that fields are separated by tab
character.
cut –f 1-5 file1  it displays 1 to 5th fields in file1.
Let us say, each piece of information is separated by a “,” then
command would be
cut –f 1-5 –d”,” file1
Quality Thought Technologies
Head: Head prints the first N number of data lines of the given
input.
By default, it prints first 10 lines of each given file.
syntax: head –n filename
Command: head -20 file1  it displays first 20 lines from file1
Tail : Tail prints the last N number of lines from given input. By
default,
it prints last 10 lines of each given file.
Syntax: tail -5 filename
Command: tail -5 file1
Process: Process is kind of program or task carried out by your PC
Process & PID defined as:
"An instance of running command is called process and the number
printed by shell is
called process-id (PID), this PID can be use to refer specific
running process.“
Quality Thought Technologies
Running command in the background: to run command in
background , you end it with an &
Command: cp file1 file2 &
How to kill job/stop job:
syntax: kill processid
Ex: kill 1020
Ps  To see currently running process
Quality Thought Technologies
diff Command:
The UNIX diff command compares the contents of two text files
and
outputs a list of differences.
it's telling you how to change the first file to make it match the
second file.
Options: -w  ignore all white spaces
-i  Ignore cases
Syntax: diff file1 file2
The first line of the diff output will contain:
line numbers corresponding to the first file,
a letter (a for add, c for change, or d for delete), and
line numbers corresponding to the second file.
Quality Thought Technologies
Lines preceded by
"<" means that the text appears in file1, and
lines preceded by
">" indicates that it comes from file2.
The three dashes ("---") separate the lines of file 1 and file 2.
Quality Thought Technologies
In our output , “1,3c1,3" means:
"Lines 1 through 3 in the first file need to be changed in order to
match lines 1 through 3 in the second file." It then tells us what
those lines are in each file:
2a3 > Here, the output is
telling us "After line 2 in the first file, a line needs to be added:
line 3from the second file." It then shows us what that line is.
4d3 Here, the output is telling us
"You need to delete line 4 in
the first file so that both files sync up at line 3." It then shows us the
contents
of the line that needs to be deleted.
Quality Thought Technologies
Both files are similar
Quality Thought
Quality Thought Technologies
In our output , “1,3c1,3" means:
"Lines 1 through 3 in the first file need to be changed in order to match lines 1 through
3 in the second file."
It then tells us what those lines are in each file:
Quality Thought Technologies
4d3 Here, the output is telling us
"You need to delete line 4 in the first file so that both files sync up at line 3." It the
of the line that needs to be deleted.
Quality Thought Technologies
3a4 > Here, the output is
telling us "After line 2 in the first file, a line needs to be added:
line 4 from the second file." It then shows us what that line is.
Quality Thought Technologies
• A shell script is an executable file which contains shell commands.
•The script acts as a "program" by sequentially executing each
command in the file.
•There are 3 most widely used shells:
•Bourne shell (.sh)
•C shell (.csh)
•Korn shell (.ksh)
Shell:
Quality Thought Technologies
•When to use shell script:
1. Customizing your work environment
2. automating your daily task
3. automating your repetitive task
4. Performing same operations on many files.
echo: Echo command is used to used to display the message
on the screen.
Quality Thought Technologies
Vi provides basic text editing capabilities.
Starting vi:
To start vi, enter:
vi filename
Where filename is the name of the file you want to edit. If the
file does not exist, vi will create it for you. You can also start
vi without giving any
filename. In this case, vi will ask for one when you quit or save
your work.
Vi editor:
Quality Thought Technologies
Modes in vi editor:
While working with vi editor you would come across following two
modes:
1. Command mode
2. Insert mode
3. ex command mode
Quality Thought Technologies
1. Command mode:
This is the default mode in this mode all the keys pressed by the user
are interpreted to be editor commands.
2. Insert mode:
Insertion of new text, editing of existed text and replacing of existed
text.
3. ex command mode:
This mode permits us to give commands at the command line. bottom of
the vi screen is called the command line. Vi used the command line
to display messages and commands.
Quality Thought Technologies
To enter insert mode, press: i
Note that in the bottom, vi indicates that you are in insert mode.
After entering text, press ESC to return to command mode.
Saving Your Work and quit (write and quit):-- :wq (press enter)
:q (quit)
:q! (forceful quit)
Quality Thought Technologies
Vi’s Exit Commands
Command Significance
:w Will write the contents of editing buffer into the file
:wq Will write and quit
ZZ Equivalent to :wq
:x Also equivalent to :wq
:q Quit
:q! Quit without saving
Quality Thought Technologies
Vi’s Move Commands
Command Significance
l or Move right one character
h or Move left one character
j or Move down one line
k or Move up one line
0 Moves the beginning of the line
$ Moves the end of the current line
+ Moves the beginning of the next line
- Moves the beginning of previous line
Quality Thought Technologies
Vi’s Modify Commands
Command Significance
dw Deletes from the cursor to the end of the word
3dw Deletes three words
d$ Deletes to the end of the line
D Same as d$
3d$ Deletes to the end of the third line ahead
d) Deletes to the beginning of the next line
d} Deletes to the beginning of the next paragraph
dd Deletes the current line
Quality Thought Technologies
Vi’s Modify Commands Cont…
Command Significance
yw Yanks a word
3yw Yanks three words
y$ Yanks to the end of the line
y) Yanks to the end of the sentence
y} Yanks to the end of the paragraph
y]] Yanks to the end of the section
yy Yanks the current line
3Y Yanks three line, starting at the current line
Quality Thought Technologies
Sample shell script:
#which is used to display current working directory , date and user
information.
pwd
date
who
# symbol marks the beginning of a comment.
Quality Thought Technologies
Quality Thought Technologies

More Related Content

Similar to Unix_QT.ppsx

Similar to Unix_QT.ppsx (20)

Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linux
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
Karkha unix shell scritping
Karkha unix shell scritpingKarkha unix shell scritping
Karkha unix shell scritping
 
Linux
LinuxLinux
Linux
 
Operating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptOperating System Laboratory presentation .ppt
Operating System Laboratory presentation .ppt
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
 
Linux Basics.pptx
Linux Basics.pptxLinux Basics.pptx
Linux Basics.pptx
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
UNIX.pptx
UNIX.pptxUNIX.pptx
UNIX.pptx
 
Group13
Group13Group13
Group13
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
lec1.docx
lec1.docxlec1.docx
lec1.docx
 
Linux
LinuxLinux
Linux
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 

Recently uploaded

How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFAAndrei Kaleshka
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...Boston Institute of Analytics
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一F La
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一F La
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 

Recently uploaded (20)

How we prevented account sharing with MFA
How we prevented account sharing with MFAHow we prevented account sharing with MFA
How we prevented account sharing with MFA
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
NLP Data Science Project Presentation:Predicting Heart Disease with NLP Data ...
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 

Unix_QT.ppsx

  • 2. What is the purpose of the session 1. As a tester why I need Unix knowledge? 2. How Unix knowledge will be helpful to increase my job opportunities? 3. As a fresher or testing fresher do I need testing knowledge? Quality Thought Technologies
  • 3. What we are not covering 1. This session is not covering Advanced Unix 2. This session is not designed with development focus Quality Thought Technologies
  • 4. How to reach out to me in case of doubts in Unix  qtramana@gmail.com Quality Thought Technologies
  • 5. UNIX is a CUI operating system. Operating System: An operating system can be defined as the software that controls the H/W resources of the computer and provides an environment under which programs can run. Quality Thought Technologies
  • 6. Flavors of UNIX: Aix by IBM Macos by apple Red hat linus by red hat s/w Solaries by sun solaries Quality Thought Technologies
  • 7. Features of Unix The Unix OS offers several features, the important of which are discussed below. Multiuser Capability Multitasking Capability Communication Security Portability Quality Thought Technologies
  • 8. Multiuser Capability Terminal Terminal Terminal Terminal Host Machine  Several users can use the same computer simultaneously i.e. , more than one keyboard and terminal can be connected to one computer.  The same data to be shared by all Quality Thought Technologies
  • 9. Multitasking Capability Performing tasks simultaneously rather than sequentially. A multi tasking operating system allows more than one program to be running at a time Quality Thought Technologies
  • 10. Communication Communication between different terminals Quality Thought Technologies
  • 11. Security Unix provides 3 levels of security to protect data. Assigning passwords and login names to individual users. At file level File encryption utility. Quality Thought Technologies
  • 12. Portability It can be ported (Transfer from one system to another) to almost any computer system. Quality Thought Technologies
  • 13. Shell Kernel Hardware Architecture of the UNIX operating system User Shell: The shell reads your commands And interprets them as a requests And then conveys them to the kernel which ultimately execute them Kernel: (Heart of nix) Which interacts with the actual H/W In machine language. File Management And Security Networkin g Services Date and Time Services Input / Output Services Signal Handling Process Scheduling System Administration and Accounting Memory Management Functions of Kernel: It manages files. Manages Memory. Scheduling of various programs. Quality Thought Technologies
  • 14. The Unix file system / (root) unix bin lib dev usr tmp etc user1 User2 . . . . bin unix: Unix kernel itself Bin: Directory contains executable files Lib: Directory all the libery functions provided by Unix. Dev: Directory contains files that controls various I/P, O/P devices Bin: Which contains additional Unix commands. Etc: binary executable files. Quality Thought Technologies
  • 15. Basic Commands logname : It prints the login name of the user (Current user name) pwd: It displays the present working directory. date : it displays system date and time (current date and time) who am i: It displays current user name, terminal number, date and time at which you logged in. who : To display data about all the users who have logged into the system currently. Quality Thought Technologies
  • 16. Creating Files: touch: It creates zero byte file. Syntax: touch filename Example: touch file1 This creates a file called file1 , the size of the file would be zero bytes. Note: touch does not allow you to store anything in a file. How to create several empty files? What if you want to store a few lines in a file? Quality Thought Technologies
  • 17. cat: to create file and another to display the contents of an existing file. Syntax: Cat > filename Command: cat > test ****** ****** ****** Ctrl+d cat >> test -- to append data to the file. cat> sample1 sample2 > newsample This would create newsample, which contains contents of sample1 followed by sample2 What if newsample already contains something? It would be overwritten cat filename --> to view the contents of an existing file. cat file1 file2 file3.
  • 18. Removing files: Command: rm rm removes the given file or files supplied to it. Syntax: rm filename Ex: rm file1 It removes file1. rm –i filename  i- interactively rm file1 file2 file3 It removes 3 files at a time Quality Thought Technologies
  • 19. Creating directory: mkdir: make directory/creates a directory Syntax: mkdir directory name Ex: mkdir hyderabad Creating multiple directories: mkdir dir1 dir2 dir3 mkdir –p dir1/dir2/dir3/dir4 Creates all the parent directories specified in the given path. Changing directory: Syntax: cd directory name Ex: cd your desired directory name. Cd  current users home directory Cd ..  to change into parent directory. Quality Thought Technologies
  • 20. Removing directory : rmdir directory name : to delete a directory but directory should be empty rm –r directory name rm –r dir1 -> recursively (–r) removes all contents of dir1 and also dir1 itself Quality Thought Technologies
  • 21. Copy a file: Syntax: cp source file target file Command: cp sample1 sample2 This will copy contents of sample1 into a sample2. if sample2 already existed it overwrites. cp –i sample1 sample2  if sample2 already existed then it asks the confirmation. Rename a file: If you want to rename the file test to sample we would say: mv test sample mv command also has the power to rename directories. mv olddir newdir Note: moving a file implies removing it from its current location and copying it at a new location mv file1 file2 newdir Quality Thought Technologies
  • 22. Word count: Syntax: wc filename It counts the number of lines, words and characters in the specified file or files. Wc –l file1 Wc file1 Wc file1 file2 file3 Wc –lwc file1 fil2 Quality Thought Technologies
  • 23. Sort: 1.Sort command can be used for sorting the contents of a file. 2.It can merge multiple sorted files and store the result in the specified output file. 3.Sort can display unique lines. Note: Sorting is done according to ASCII collating sequence. Syntax: sort filename Command: Sort myfile Sorting multiple files: sort file1 file2 file3 sort –o myresuly file1 file2 file3 sort –u –o result file1 file2 file3 sort –m file1 file2 -m  Merge file1 content with file2. Quality Thought Technologies
  • 24. Removing duplicate lines using uniq: uniq utility compare only adjacent lines, duplicate lines must be next to each other in the file. To solve this problem you can use command as follows $ sort personame | uniq Quality Thought Technologies
  • 25. Listing files and directories: Lists the content of the current or specified directory. ls ls –a  to display files and directories including hidden files. .  stands for current directory ..  parent of the current directory. Note: These two entries automatically get created in the dir whenever the dir is created. Ls –ltr l  it displays files and dir in long format Ls –l |grep ^d  to display only directories - ordinary file Quality Thought Technologies
  • 26. Permissions: There are 3 classes of file permissions for the 3 classes of users. 1. Owner/user 2. Group 3. Others Ls –l - rwx r- - r- - Permissions weight R- read - 4 W- write -2 X- execute -1 Quality Thought Technologies
  • 27. Changing file permissions: Chmod to change file/dir permissions. Chmod 700 filename Quality Thought Technologies
  • 28. gzip: This command compresses the given file and replaces it with the compressed version name Syntax: gzip filename gunzip: to unzip compressed file Syntax: gunzip filename.gz Quality Thought Technologies
  • 29. Filter commands: 1.Grep 2.Sort 3.cut Grep: Globally search a regular expression. syntax: grep "word-to-find" {file-name} Command: grep hyderabad sample1 grep will locate all lines for the " hyderabad " pattern and print all (matched) such line on-screen. Quality Thought Technologies
  • 30. grep "." myfile.txt The above command returns every line of myfile.txt. Options -c  it returns only number of matches. -i  ignores case while searching -v  returns lines that do not match the test Quality Thought Technologies
  • 31. Cut command: It cuts or pick up a given number of character or fields from the specified file. Command: cut –f 2 file1  it displays second filed in file1. Cut –f 2,4 file1  it displays 2,4th fields in file1. Here, cut command assumes that fields are separated by tab character. cut –f 1-5 file1  it displays 1 to 5th fields in file1. Let us say, each piece of information is separated by a “,” then command would be cut –f 1-5 –d”,” file1 Quality Thought Technologies
  • 32. Head: Head prints the first N number of data lines of the given input. By default, it prints first 10 lines of each given file. syntax: head –n filename Command: head -20 file1  it displays first 20 lines from file1 Tail : Tail prints the last N number of lines from given input. By default, it prints last 10 lines of each given file. Syntax: tail -5 filename Command: tail -5 file1 Process: Process is kind of program or task carried out by your PC Process & PID defined as: "An instance of running command is called process and the number printed by shell is called process-id (PID), this PID can be use to refer specific running process.“ Quality Thought Technologies
  • 33. Running command in the background: to run command in background , you end it with an & Command: cp file1 file2 & How to kill job/stop job: syntax: kill processid Ex: kill 1020 Ps  To see currently running process Quality Thought Technologies
  • 34. diff Command: The UNIX diff command compares the contents of two text files and outputs a list of differences. it's telling you how to change the first file to make it match the second file. Options: -w  ignore all white spaces -i  Ignore cases Syntax: diff file1 file2 The first line of the diff output will contain: line numbers corresponding to the first file, a letter (a for add, c for change, or d for delete), and line numbers corresponding to the second file. Quality Thought Technologies
  • 35. Lines preceded by "<" means that the text appears in file1, and lines preceded by ">" indicates that it comes from file2. The three dashes ("---") separate the lines of file 1 and file 2. Quality Thought Technologies
  • 36. In our output , “1,3c1,3" means: "Lines 1 through 3 in the first file need to be changed in order to match lines 1 through 3 in the second file." It then tells us what those lines are in each file: 2a3 > Here, the output is telling us "After line 2 in the first file, a line needs to be added: line 3from the second file." It then shows us what that line is. 4d3 Here, the output is telling us "You need to delete line 4 in the first file so that both files sync up at line 3." It then shows us the contents of the line that needs to be deleted. Quality Thought Technologies
  • 37. Both files are similar Quality Thought Quality Thought Technologies
  • 38. In our output , “1,3c1,3" means: "Lines 1 through 3 in the first file need to be changed in order to match lines 1 through 3 in the second file." It then tells us what those lines are in each file: Quality Thought Technologies
  • 39. 4d3 Here, the output is telling us "You need to delete line 4 in the first file so that both files sync up at line 3." It the of the line that needs to be deleted. Quality Thought Technologies
  • 40. 3a4 > Here, the output is telling us "After line 2 in the first file, a line needs to be added: line 4 from the second file." It then shows us what that line is. Quality Thought Technologies
  • 41. • A shell script is an executable file which contains shell commands. •The script acts as a "program" by sequentially executing each command in the file. •There are 3 most widely used shells: •Bourne shell (.sh) •C shell (.csh) •Korn shell (.ksh) Shell: Quality Thought Technologies
  • 42. •When to use shell script: 1. Customizing your work environment 2. automating your daily task 3. automating your repetitive task 4. Performing same operations on many files. echo: Echo command is used to used to display the message on the screen. Quality Thought Technologies
  • 43. Vi provides basic text editing capabilities. Starting vi: To start vi, enter: vi filename Where filename is the name of the file you want to edit. If the file does not exist, vi will create it for you. You can also start vi without giving any filename. In this case, vi will ask for one when you quit or save your work. Vi editor: Quality Thought Technologies
  • 44. Modes in vi editor: While working with vi editor you would come across following two modes: 1. Command mode 2. Insert mode 3. ex command mode Quality Thought Technologies
  • 45. 1. Command mode: This is the default mode in this mode all the keys pressed by the user are interpreted to be editor commands. 2. Insert mode: Insertion of new text, editing of existed text and replacing of existed text. 3. ex command mode: This mode permits us to give commands at the command line. bottom of the vi screen is called the command line. Vi used the command line to display messages and commands. Quality Thought Technologies
  • 46. To enter insert mode, press: i Note that in the bottom, vi indicates that you are in insert mode. After entering text, press ESC to return to command mode. Saving Your Work and quit (write and quit):-- :wq (press enter) :q (quit) :q! (forceful quit) Quality Thought Technologies
  • 47. Vi’s Exit Commands Command Significance :w Will write the contents of editing buffer into the file :wq Will write and quit ZZ Equivalent to :wq :x Also equivalent to :wq :q Quit :q! Quit without saving Quality Thought Technologies
  • 48. Vi’s Move Commands Command Significance l or Move right one character h or Move left one character j or Move down one line k or Move up one line 0 Moves the beginning of the line $ Moves the end of the current line + Moves the beginning of the next line - Moves the beginning of previous line Quality Thought Technologies
  • 49. Vi’s Modify Commands Command Significance dw Deletes from the cursor to the end of the word 3dw Deletes three words d$ Deletes to the end of the line D Same as d$ 3d$ Deletes to the end of the third line ahead d) Deletes to the beginning of the next line d} Deletes to the beginning of the next paragraph dd Deletes the current line Quality Thought Technologies
  • 50. Vi’s Modify Commands Cont… Command Significance yw Yanks a word 3yw Yanks three words y$ Yanks to the end of the line y) Yanks to the end of the sentence y} Yanks to the end of the paragraph y]] Yanks to the end of the section yy Yanks the current line 3Y Yanks three line, starting at the current line Quality Thought Technologies
  • 51. Sample shell script: #which is used to display current working directory , date and user information. pwd date who # symbol marks the beginning of a comment. Quality Thought Technologies