SlideShare a Scribd company logo
1 of 18
Linux Commands
File Handling
Call Us : 404-900-9988
Email: info@quontrasolutions.com
Website: www.quontrasolutions.com
Topics
head
tail
link
tar
gzip and gunzip
touch
diff
‘head’ command
Displays the first ten lines of a file, unless otherwise stated.
Syntax:
head [-number | -n number] filename
Example:
head -15 myfile.txt
It displays the first 15 lines of ‘myfile.txt’ .
-number Number of lines to display
-n number Number of lines to display
filename Desired filename
‘tail’ command
Displays the last ten lines of a file, unless otherwise stated.
Syntax:
• tail [-n number] [-l] [-b] [-c] [-r] [-f] [file]
-n number Number of lines to display
-l Units of lines.
-b Units of blocks.
-c Units of bytes.
-r Copies lines from the specified starting
point in the file in reverse order.
-f Displays the last 10 lines and then update
the file as new lines are being added.
filename Desired filename
‘link’ command
Creates a link to the file or directory.
Syntax:
ln [-f] [-n] [-s] [-i] source destination
-f Forced to create a link.
-n Does not overwrite existing
files.
-s Creates a Symbolic link.
source Desired filename
destination Destination filename
Example:
ln –s f1 home/myfiles/f2
Creates a symbolic link between file ‘f1’ to file ‘f3’ of ‘myfiles’ directory.
Represented as ‘’
 View the Link using :
ls –l
 Remove the link using ‘rm’ command.
rm –r f1.
‘tar’ command
Used to group set of files in to ma single file. It is called Archive
file.
Syntax:
tar [-c] [-t or -v] [-x] [-f] filename archivefilename
 It has ‘.tar’ extension.
-c Creates an archive file.
-t or -v Lists archive file content.
-x Extract or de archive an archive file.
filename File to be archived
archivefilename New name for archive file.
Examples:
1. Create an archive file
tar –vcf dir1 myarc.tar
It creates archive file ‘myarc.tar’ which has all files of directory ‘dir1’.
2. Dearchive an archive file
tar –xvf myarc.tar
All files in ‘dir1’ are no more grouped, they are separated.
‘gzip’ and ‘gunzip’
Used to compress and decompress the file respectively.
Syntax:
gzip [-f][-d] filename.
gunzip [-f] compressedfilename.
• It is with ‘.gz’ extension.
-f Compress forcibly.
-d Decompress the compressed file.
filename File to be compressed.
Examples:
1. Compress the file.
gzip –f f1.
Compresses the file ‘f1’ and is represented as ‘f1.gz’.
2. Decompress the compressed file.
gzip –d f1.gz or gunzip –f f1.gz
File ‘f1.gz’ is decompressed to file ‘f1’.
‘touch’ command
Used to change the timestamp of a file. It is also used to
create multiple files at one shot.
Syntax:
touch –t [-a][-m] [-r reference-file] filename
a To change access time
m To change modified time
-r Refer the timestamp of another file
filename Required filename
Use ‘Stat’ command to know the Timestamp.
$ stat f1.c
(sample output)
Access: 2010-11-01 20:35:58.000000000 +0530
Modify: 2010-11-01 20:35:58.000000000 +0530
Change: 2010-11-01 20:35:58.000000000 +0530
Format for touch -t is : [YY]MMDDhhmm[.ss]
Examples:
1. Create multiple files at once.
$ touch file1.txt file2.txt file3.txt
2. Change the access time of a file.
$ touch –t -a 08210820 file1.txt
Access: 2010-06-15 13:30:00.000000000 +0530
Modify: 2010-08-21 08:20:00.000000000 +0530
Change: 2010-11-01 20:45:05.000000000 +0530
Same way we can change the modified time of a file using ‘-m’ along with
‘-t’
4. Refer the timestamp of another file than the current time.
$touch -r file4 file5
file 5 uses the timestamp of file4.
‘diff’ command
It is used to find differences between two files.
Syntax:
diff [options] file1 file2
Options:
a Treats all files as text and compare
them line-by-line.
y Use the side by side output format.
w Ignore white space/blank space
when comparing lines.
i Ignores Case.
Let us have two files, file1.txt and file2.txt as follows:
file1.txt file2.txt
LINUX TEST
goodmorning
with great thoughts
Lead india
LINUX TEST
GOODMORNING
with great thoughts
Examples:
1. Compare the files side by side, ignoring white space.
diff -by file1.txt file2.txt
LINUX TEST LINUX TEST
hscripts.com | HSCRIPTS.com
with great thoughts with great thoughts
Lead India <
2. Compare the files side by side, ignoring Case.
diff -iy file1.txt file2.txt
LINUX TEST LINUX TEST
hscripts.com HSCRIPTS.com
with great thoughts | with great thoughts
Lead India <
Thankyou

More Related Content

More from QUONTRASOLUTIONS

Software Quality Assurance training by QuontraSolutions
Software Quality Assurance training by QuontraSolutionsSoftware Quality Assurance training by QuontraSolutions
Software Quality Assurance training by QuontraSolutionsQUONTRASOLUTIONS
 
Introduction to software quality assurance by QuontraSolutions
Introduction to software quality assurance by QuontraSolutionsIntroduction to software quality assurance by QuontraSolutions
Introduction to software quality assurance by QuontraSolutionsQUONTRASOLUTIONS
 
.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions.Net introduction by Quontra Solutions
.Net introduction by Quontra SolutionsQUONTRASOLUTIONS
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classQUONTRASOLUTIONS
 
Saas overview by quontra solutions
Saas overview  by quontra solutionsSaas overview  by quontra solutions
Saas overview by quontra solutionsQUONTRASOLUTIONS
 
Sharepoint taxonomy introduction us
Sharepoint taxonomy introduction   usSharepoint taxonomy introduction   us
Sharepoint taxonomy introduction usQUONTRASOLUTIONS
 
Introduction to the sharepoint 2013 userprofile service By Quontra
Introduction to the sharepoint 2013 userprofile service By QuontraIntroduction to the sharepoint 2013 userprofile service By Quontra
Introduction to the sharepoint 2013 userprofile service By QuontraQUONTRASOLUTIONS
 
Introduction to SharePoint 2013 REST API
Introduction to SharePoint 2013 REST APIIntroduction to SharePoint 2013 REST API
Introduction to SharePoint 2013 REST APIQUONTRASOLUTIONS
 
Performance Testing and OBIEE by QuontraSolutions
Performance Testing and OBIEE by QuontraSolutionsPerformance Testing and OBIEE by QuontraSolutions
Performance Testing and OBIEE by QuontraSolutionsQUONTRASOLUTIONS
 
Obiee introduction building reports by QuontraSolutions
Obiee introduction building reports by QuontraSolutionsObiee introduction building reports by QuontraSolutions
Obiee introduction building reports by QuontraSolutionsQUONTRASOLUTIONS
 
Sharepoint designer workflow by quontra us
Sharepoint designer workflow by quontra usSharepoint designer workflow by quontra us
Sharepoint designer workflow by quontra usQUONTRASOLUTIONS
 
MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra QUONTRASOLUTIONS
 
Introduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsIntroduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsQUONTRASOLUTIONS
 
Core java over view basics introduction by quontra solutions
Core java over view basics introduction by quontra solutionsCore java over view basics introduction by quontra solutions
Core java over view basics introduction by quontra solutionsQUONTRASOLUTIONS
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPTQUONTRASOLUTIONS
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsQUONTRASOLUTIONS
 

More from QUONTRASOLUTIONS (20)

Hibernate online training
Hibernate online trainingHibernate online training
Hibernate online training
 
Java j2eeTutorial
Java j2eeTutorialJava j2eeTutorial
Java j2eeTutorial
 
Software Quality Assurance training by QuontraSolutions
Software Quality Assurance training by QuontraSolutionsSoftware Quality Assurance training by QuontraSolutions
Software Quality Assurance training by QuontraSolutions
 
Introduction to software quality assurance by QuontraSolutions
Introduction to software quality assurance by QuontraSolutionsIntroduction to software quality assurance by QuontraSolutions
Introduction to software quality assurance by QuontraSolutions
 
.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training class
 
Saas overview by quontra solutions
Saas overview  by quontra solutionsSaas overview  by quontra solutions
Saas overview by quontra solutions
 
Sharepoint taxonomy introduction us
Sharepoint taxonomy introduction   usSharepoint taxonomy introduction   us
Sharepoint taxonomy introduction us
 
Introduction to the sharepoint 2013 userprofile service By Quontra
Introduction to the sharepoint 2013 userprofile service By QuontraIntroduction to the sharepoint 2013 userprofile service By Quontra
Introduction to the sharepoint 2013 userprofile service By Quontra
 
Introduction to SharePoint 2013 REST API
Introduction to SharePoint 2013 REST APIIntroduction to SharePoint 2013 REST API
Introduction to SharePoint 2013 REST API
 
Performance Testing and OBIEE by QuontraSolutions
Performance Testing and OBIEE by QuontraSolutionsPerformance Testing and OBIEE by QuontraSolutions
Performance Testing and OBIEE by QuontraSolutions
 
Obiee introduction building reports by QuontraSolutions
Obiee introduction building reports by QuontraSolutionsObiee introduction building reports by QuontraSolutions
Obiee introduction building reports by QuontraSolutions
 
Sharepoint designer workflow by quontra us
Sharepoint designer workflow by quontra usSharepoint designer workflow by quontra us
Sharepoint designer workflow by quontra us
 
Qa by quontra us
Qa by quontra   usQa by quontra   us
Qa by quontra us
 
MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra
 
Msbi by quontra us
Msbi by quontra usMsbi by quontra us
Msbi by quontra us
 
Introduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsIntroduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutions
 
Core java over view basics introduction by quontra solutions
Core java over view basics introduction by quontra solutionsCore java over view basics introduction by quontra solutions
Core java over view basics introduction by quontra solutions
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPT
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 

Recently uploaded

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

Linux commands Presented by Quontra Solutions

  • 1. Linux Commands File Handling Call Us : 404-900-9988 Email: info@quontrasolutions.com Website: www.quontrasolutions.com
  • 3. ‘head’ command Displays the first ten lines of a file, unless otherwise stated. Syntax: head [-number | -n number] filename Example: head -15 myfile.txt It displays the first 15 lines of ‘myfile.txt’ . -number Number of lines to display -n number Number of lines to display filename Desired filename
  • 4. ‘tail’ command Displays the last ten lines of a file, unless otherwise stated. Syntax: • tail [-n number] [-l] [-b] [-c] [-r] [-f] [file] -n number Number of lines to display -l Units of lines. -b Units of blocks. -c Units of bytes. -r Copies lines from the specified starting point in the file in reverse order. -f Displays the last 10 lines and then update the file as new lines are being added. filename Desired filename
  • 5. ‘link’ command Creates a link to the file or directory. Syntax: ln [-f] [-n] [-s] [-i] source destination -f Forced to create a link. -n Does not overwrite existing files. -s Creates a Symbolic link. source Desired filename destination Destination filename
  • 6. Example: ln –s f1 home/myfiles/f2 Creates a symbolic link between file ‘f1’ to file ‘f3’ of ‘myfiles’ directory. Represented as ‘’  View the Link using : ls –l  Remove the link using ‘rm’ command. rm –r f1.
  • 7. ‘tar’ command Used to group set of files in to ma single file. It is called Archive file. Syntax: tar [-c] [-t or -v] [-x] [-f] filename archivefilename  It has ‘.tar’ extension. -c Creates an archive file. -t or -v Lists archive file content. -x Extract or de archive an archive file. filename File to be archived archivefilename New name for archive file.
  • 8. Examples: 1. Create an archive file tar –vcf dir1 myarc.tar It creates archive file ‘myarc.tar’ which has all files of directory ‘dir1’. 2. Dearchive an archive file tar –xvf myarc.tar All files in ‘dir1’ are no more grouped, they are separated.
  • 9. ‘gzip’ and ‘gunzip’ Used to compress and decompress the file respectively. Syntax: gzip [-f][-d] filename. gunzip [-f] compressedfilename. • It is with ‘.gz’ extension. -f Compress forcibly. -d Decompress the compressed file. filename File to be compressed.
  • 10. Examples: 1. Compress the file. gzip –f f1. Compresses the file ‘f1’ and is represented as ‘f1.gz’. 2. Decompress the compressed file. gzip –d f1.gz or gunzip –f f1.gz File ‘f1.gz’ is decompressed to file ‘f1’.
  • 11. ‘touch’ command Used to change the timestamp of a file. It is also used to create multiple files at one shot. Syntax: touch –t [-a][-m] [-r reference-file] filename a To change access time m To change modified time -r Refer the timestamp of another file filename Required filename
  • 12. Use ‘Stat’ command to know the Timestamp. $ stat f1.c (sample output) Access: 2010-11-01 20:35:58.000000000 +0530 Modify: 2010-11-01 20:35:58.000000000 +0530 Change: 2010-11-01 20:35:58.000000000 +0530 Format for touch -t is : [YY]MMDDhhmm[.ss]
  • 13. Examples: 1. Create multiple files at once. $ touch file1.txt file2.txt file3.txt 2. Change the access time of a file. $ touch –t -a 08210820 file1.txt Access: 2010-06-15 13:30:00.000000000 +0530 Modify: 2010-08-21 08:20:00.000000000 +0530 Change: 2010-11-01 20:45:05.000000000 +0530
  • 14. Same way we can change the modified time of a file using ‘-m’ along with ‘-t’ 4. Refer the timestamp of another file than the current time. $touch -r file4 file5 file 5 uses the timestamp of file4.
  • 15. ‘diff’ command It is used to find differences between two files. Syntax: diff [options] file1 file2 Options: a Treats all files as text and compare them line-by-line. y Use the side by side output format. w Ignore white space/blank space when comparing lines. i Ignores Case.
  • 16. Let us have two files, file1.txt and file2.txt as follows: file1.txt file2.txt LINUX TEST goodmorning with great thoughts Lead india LINUX TEST GOODMORNING with great thoughts
  • 17. Examples: 1. Compare the files side by side, ignoring white space. diff -by file1.txt file2.txt LINUX TEST LINUX TEST hscripts.com | HSCRIPTS.com with great thoughts with great thoughts Lead India < 2. Compare the files side by side, ignoring Case. diff -iy file1.txt file2.txt LINUX TEST LINUX TEST hscripts.com HSCRIPTS.com with great thoughts | with great thoughts Lead India <