SlideShare a Scribd company logo
Chapter 4Chapter 4
File ArchiveFile Archive
Ref. Pge. 184
UsingUsing zipzip
●
zip archive.zip inpath ...zip archive.zip inpath ...
– Package files and perform compressionPackage files and perform compression
– Common optionsCommon options
●
­r­r : recurse into directories: recurse into directories
●
­1­1 : compress faster: compress faster
●
­9­9 : more compress: more compress
●
­e­e : perform encryption: perform encryption
UsingUsing unzipunzip
●
unzip archive.zip [list ...]unzip archive.zip [list ...]
– Extract files in list from a zipped file.Extract files in list from a zipped file.
– All files will be extracted without list.All files will be extracted without list.
– Common optionsCommon options
●
­l­l : list files in archive: list files in archive
●
­t­t : test only: test only
●
­n­n : never overwrite existing files: never overwrite existing files
●
­o­o : overwrite existing files without prompting: overwrite existing files without prompting
UsingUsing gzipgzip
●
gzip file ...gzip file ...
– Compress one or more file separatelyCompress one or more file separately
– The .gz suffix will automatically appendedThe .gz suffix will automatically appended
– The origin file will be removed after zippedThe origin file will be removed after zipped
– Common options:Common options:
●
­c­c : write on standard output, keep origin file: write on standard output, keep origin file
●
­r­r : recurse into directories: recurse into directories
●
­9­9 : more compress: more compress
●
­e­e : encryption: encryption
UsingUsing gunzipgunzip
●
gunzip file.gz ...gunzip file.gz ...
– Extract one or more gzipped fileExtract one or more gzipped file
– Common optionsCommon options
●
­c­c : write on standard output, keep zipped file: write on standard output, keep zipped file
●
­l­l : list files: list files
●
­t­t : test only: test only
UsingUsing bzip2bzip2 andand bunzip2bunzip2
●
Compression is generally considerablyCompression is generally considerably
better thanbetter than gzipgzip andand gunzipgunzip, with similar, with similar
options.options.
●
The file suffix isThe file suffix is .bz2.bz2
UsingUsing tartar
●
tar <mode> ­f archive.tar file ...tar <mode> ­f archive.tar file ...
– Store/extract files to/from a tape or disk archiveStore/extract files to/from a tape or disk archive
– Major modes:Major modes:
●
­c­c : create an archive: create an archive
●
­t­t : list the contents of an archive: list the contents of an archive
●
­x­x : extract files from an archive: extract files from an archive
Ref. Pge. 184
Common Options ofCommon Options of tartar
●
­z­z : using gzip/gunzip: using gzip/gunzip
●
­j­j : using bzip2/bunzip2: using bzip2/bunzip2
●
­O­O : extract files to standard output: extract files to standard output
●
­p­p : permissions preserved: permissions preserved
●
­P­P : keep the absolute path: keep the absolute path
●
­v­v : verbosely list files processed: verbosely list files processed
●
­X list.file­X list.file : Excluding files from list: Excluding files from list
●
­T list.file­T list.file : Only archive files from list: Only archive files from list
●
­T ­­T ­ : Only archive files from STDIN in pipe: Only archive files from STDIN in pipe
Incremental Backup UsingIncremental Backup Using tartar
●
Create a snapshot while performing fullCreate a snapshot while performing full
backup:backup:
tar ­cz ­g snapshot ­f full.tar.gz /dirtar ­cz ­g snapshot ­f full.tar.gz /dir
●
Perform incremental backup by referring toPerform incremental backup by referring to
the snapshot:the snapshot:
tar ­cz ­g snapshot ­f incr1.tar.gz /dirtar ­cz ­g snapshot ­f incr1.tar.gz /dir
tar ­cz ­g snapshot ­f incr2.tar.gz /dirtar ­cz ­g snapshot ­f incr2.tar.gz /dir
●
Tips:Tips:
– Return to full backup by removing the snapshot.Return to full backup by removing the snapshot.
Restore File UsingRestore File Using tartar
●
1st, change working to the parent1st, change working to the parent
●
Restore file from full backup:Restore file from full backup:
tar ­xvz ­f full.tar.gz tar ­xvz ­f full.tar.gz 
●
Then restore the incremental backups in order:Then restore the incremental backups in order:
tar ­xz ­g snapshot ­f incr1.tar.gz /dirtar ­xz ­g snapshot ­f incr1.tar.gz /dir
tar ­xz ­g snapshot ­f incr2.tar.gz /dirtar ­xz ­g snapshot ­f incr2.tar.gz /dir
UsingUsing cpiocpio
●
Perform backup:Perform backup:
cd /dircd /dir
find | cpio ­o | gzip > archive.cpio.gz find | cpio ­o | gzip > archive.cpio.gz 
●
Perform restore:Perform restore:
gunzip ­c archive.cpio.gz | cpio ­igunzip ­c archive.cpio.gz | cpio ­i
Ref. Pge. 186
UsingUsing dddd
●
Dumping a whole partition image:Dumping a whole partition image:
dd if=/dev/sda3 of=/dev/st0dd if=/dev/sda3 of=/dev/st0
●
Restore partition:Restore partition:
dd if=/dev/st0 of=/dev/sda3dd if=/dev/st0 of=/dev/sda3
●
Backup the MBR:Backup the MBR:
dd if=/dev/sda of=/sda.mbr bs=512 count=1dd if=/dev/sda of=/sda.mbr bs=512 count=1
Ref. Pge. 188

More Related Content

PDF
Linux fundamental - Chap 03 file
PDF
Linux fundamental - Chap 02 perm
PDF
Linux fundamental - Chap 11 boot
PDF
Linux fundamental - Chap 10 fs
PDF
Linux fundamental - Chap 01 io
PDF
Linux fundamental - Chap 08 proc
PDF
Chap 17 advfs
PDF
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 03 file
Linux fundamental - Chap 02 perm
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 10 fs
Linux fundamental - Chap 01 io
Linux fundamental - Chap 08 proc
Chap 17 advfs
Linux fundamental - Chap 12 Hardware Management

What's hot (20)

PDF
Linux fundamental - Chap 09 pkg
PDF
Archiving in linux tar
PDF
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PPTX
11 linux filesystem copy
PDF
FUSE Filesystems
PDF
Basic Linux commands
PDF
Recipe of a linux Live CD (archived)
RTF
Useful linux-commands
ODP
LSA2 - 02 Control Groups
PDF
Chap 19 web
PPT
101 1.2 boot the system
PPT
Basic linux day 5
PDF
2.1.using the shell
PPT
Linux filesystemhierarchy
PDF
Linux Common Command
ODP
Os Bernier
PDF
Part 6 of "Introduction to linux for bioinformatics": Productivity tips
PDF
Importance of linux system fundamental in technical documentation reading
PDF
Quick Guide with Linux Command Line
Linux fundamental - Chap 09 pkg
Archiving in linux tar
PostgreSQL on EXT4, XFS, BTRFS and ZFS
11 linux filesystem copy
FUSE Filesystems
Basic Linux commands
Recipe of a linux Live CD (archived)
Useful linux-commands
LSA2 - 02 Control Groups
Chap 19 web
101 1.2 boot the system
Basic linux day 5
2.1.using the shell
Linux filesystemhierarchy
Linux Common Command
Os Bernier
Part 6 of "Introduction to linux for bioinformatics": Productivity tips
Importance of linux system fundamental in technical documentation reading
Quick Guide with Linux Command Line
Ad

Viewers also liked (9)

PPTX
File system.
PPT
File Management
PPTX
file system in operating system
PPTX
File management
PPT
File system
PPS
Functions Of Operating System
PPTX
Functions Of Operating Systems
PDF
Leadership - Training by Spreadminds
PPTX
Operating Systems - File Management
File system.
File Management
file system in operating system
File management
File system
Functions Of Operating System
Functions Of Operating Systems
Leadership - Training by Spreadminds
Operating Systems - File Management
Ad

Similar to Linux fundamental - Chap 04 archive (20)

PPT
Compression Commands in Linux
PDF
Course 102: Lecture 24: Archiving and Compression of Files
PPT
101 apend. backups
PPTX
linuxtl04.pptx
PPT
4.8 apend backups
PDF
Siemens s7 300-400-pkzip 4.0
PPSX
Management file and directory in linux
TXT
PPTX
Compression
DOC
Zipnotes
TXT
PPT
101 3.3 perform basic file management
PPTX
Linux files
PDF
Server Logs: After Excel Fails
PPT
PPT
Winzip and winrar
TXT
Whats new
PPTX
12 linux archiving tools
Compression Commands in Linux
Course 102: Lecture 24: Archiving and Compression of Files
101 apend. backups
linuxtl04.pptx
4.8 apend backups
Siemens s7 300-400-pkzip 4.0
Management file and directory in linux
Compression
Zipnotes
101 3.3 perform basic file management
Linux files
Server Logs: After Excel Fails
Winzip and winrar
Whats new
12 linux archiving tools

More from Kenny (netman) (19)

TXT
rpi_audio configuration steps
PDF
Rpi audio
PDF
Ha opensuse
PDF
Chap 18 net
PDF
About the Course
PDF
Linux fundamental - Chap 16 System Rescue
PDF
Linux fundamental - Chap 15 Job Scheduling
PDF
Linux fundamental - Chap 14 shell script
PDF
Linux fundamental - Chap 13 account management
PDF
Linux fundamental - Chap 07 vi
PDF
Linux fundamental - Chap 06 regx
PDF
Linux fundamental - Chap 05 filter
PDF
Linux fundamental - Chap 00 shell
PDF
Linux system security
PDF
Linux network monitoring hands-on pratice
PDF
Linux Network Monitoring
PDF
加密應用(GPG)
PDF
金鑰管理 (PKI)
PDF
Linux firewall
rpi_audio configuration steps
Rpi audio
Ha opensuse
Chap 18 net
About the Course
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 00 shell
Linux system security
Linux network monitoring hands-on pratice
Linux Network Monitoring
加密應用(GPG)
金鑰管理 (PKI)
Linux firewall

Recently uploaded (20)

PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
Classroom Observation Tools for Teachers
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Business Ethics Teaching Materials for college
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Pharma ospi slides which help in ospi learning
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Cell Structure & Organelles in detailed.
PPH.pptx obstetrics and gynecology in nursing
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
RMMM.pdf make it easy to upload and study
Classroom Observation Tools for Teachers
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Renaissance Architecture: A Journey from Faith to Humanism
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Final Presentation General Medicine 03-08-2024.pptx
01-Introduction-to-Information-Management.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Business Ethics Teaching Materials for college
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
STATICS OF THE RIGID BODIES Hibbelers.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Supply Chain Operations Speaking Notes -ICLT Program
Pharma ospi slides which help in ospi learning
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Module 4: Burden of Disease Tutorial Slides S2 2025
Cell Structure & Organelles in detailed.

Linux fundamental - Chap 04 archive

  • 1. Chapter 4Chapter 4 File ArchiveFile Archive Ref. Pge. 184
  • 2. UsingUsing zipzip ● zip archive.zip inpath ...zip archive.zip inpath ... – Package files and perform compressionPackage files and perform compression – Common optionsCommon options ● ­r­r : recurse into directories: recurse into directories ● ­1­1 : compress faster: compress faster ● ­9­9 : more compress: more compress ● ­e­e : perform encryption: perform encryption
  • 3. UsingUsing unzipunzip ● unzip archive.zip [list ...]unzip archive.zip [list ...] – Extract files in list from a zipped file.Extract files in list from a zipped file. – All files will be extracted without list.All files will be extracted without list. – Common optionsCommon options ● ­l­l : list files in archive: list files in archive ● ­t­t : test only: test only ● ­n­n : never overwrite existing files: never overwrite existing files ● ­o­o : overwrite existing files without prompting: overwrite existing files without prompting
  • 4. UsingUsing gzipgzip ● gzip file ...gzip file ... – Compress one or more file separatelyCompress one or more file separately – The .gz suffix will automatically appendedThe .gz suffix will automatically appended – The origin file will be removed after zippedThe origin file will be removed after zipped – Common options:Common options: ● ­c­c : write on standard output, keep origin file: write on standard output, keep origin file ● ­r­r : recurse into directories: recurse into directories ● ­9­9 : more compress: more compress ● ­e­e : encryption: encryption
  • 5. UsingUsing gunzipgunzip ● gunzip file.gz ...gunzip file.gz ... – Extract one or more gzipped fileExtract one or more gzipped file – Common optionsCommon options ● ­c­c : write on standard output, keep zipped file: write on standard output, keep zipped file ● ­l­l : list files: list files ● ­t­t : test only: test only
  • 6. UsingUsing bzip2bzip2 andand bunzip2bunzip2 ● Compression is generally considerablyCompression is generally considerably better thanbetter than gzipgzip andand gunzipgunzip, with similar, with similar options.options. ● The file suffix isThe file suffix is .bz2.bz2
  • 7. UsingUsing tartar ● tar <mode> ­f archive.tar file ...tar <mode> ­f archive.tar file ... – Store/extract files to/from a tape or disk archiveStore/extract files to/from a tape or disk archive – Major modes:Major modes: ● ­c­c : create an archive: create an archive ● ­t­t : list the contents of an archive: list the contents of an archive ● ­x­x : extract files from an archive: extract files from an archive Ref. Pge. 184
  • 8. Common Options ofCommon Options of tartar ● ­z­z : using gzip/gunzip: using gzip/gunzip ● ­j­j : using bzip2/bunzip2: using bzip2/bunzip2 ● ­O­O : extract files to standard output: extract files to standard output ● ­p­p : permissions preserved: permissions preserved ● ­P­P : keep the absolute path: keep the absolute path ● ­v­v : verbosely list files processed: verbosely list files processed ● ­X list.file­X list.file : Excluding files from list: Excluding files from list ● ­T list.file­T list.file : Only archive files from list: Only archive files from list ● ­T ­­T ­ : Only archive files from STDIN in pipe: Only archive files from STDIN in pipe
  • 9. Incremental Backup UsingIncremental Backup Using tartar ● Create a snapshot while performing fullCreate a snapshot while performing full backup:backup: tar ­cz ­g snapshot ­f full.tar.gz /dirtar ­cz ­g snapshot ­f full.tar.gz /dir ● Perform incremental backup by referring toPerform incremental backup by referring to the snapshot:the snapshot: tar ­cz ­g snapshot ­f incr1.tar.gz /dirtar ­cz ­g snapshot ­f incr1.tar.gz /dir tar ­cz ­g snapshot ­f incr2.tar.gz /dirtar ­cz ­g snapshot ­f incr2.tar.gz /dir ● Tips:Tips: – Return to full backup by removing the snapshot.Return to full backup by removing the snapshot.
  • 10. Restore File UsingRestore File Using tartar ● 1st, change working to the parent1st, change working to the parent ● Restore file from full backup:Restore file from full backup: tar ­xvz ­f full.tar.gz tar ­xvz ­f full.tar.gz  ● Then restore the incremental backups in order:Then restore the incremental backups in order: tar ­xz ­g snapshot ­f incr1.tar.gz /dirtar ­xz ­g snapshot ­f incr1.tar.gz /dir tar ­xz ­g snapshot ­f incr2.tar.gz /dirtar ­xz ­g snapshot ­f incr2.tar.gz /dir
  • 11. UsingUsing cpiocpio ● Perform backup:Perform backup: cd /dircd /dir find | cpio ­o | gzip > archive.cpio.gz find | cpio ­o | gzip > archive.cpio.gz  ● Perform restore:Perform restore: gunzip ­c archive.cpio.gz | cpio ­igunzip ­c archive.cpio.gz | cpio ­i Ref. Pge. 186
  • 12. UsingUsing dddd ● Dumping a whole partition image:Dumping a whole partition image: dd if=/dev/sda3 of=/dev/st0dd if=/dev/sda3 of=/dev/st0 ● Restore partition:Restore partition: dd if=/dev/st0 of=/dev/sda3dd if=/dev/st0 of=/dev/sda3 ● Backup the MBR:Backup the MBR: dd if=/dev/sda of=/sda.mbr bs=512 count=1dd if=/dev/sda of=/sda.mbr bs=512 count=1 Ref. Pge. 188