12 linux archiving tools

9
Managing File Structures

description

Unix / Linux Fundamentals

Transcript of 12 linux archiving tools

Page 1: 12 linux archiving tools

Managing File Structures

Page 2: 12 linux archiving tools

Managing• Linux uses files for storing most object types on the system,

such as user programs and data• Linux power tools has three main tool categories for

managing file “trees”– Archive Tools

While working with a large amount files using an archive can reduce the complexity in transferring, backing up or restoring entire file “trees”

– Compression ToolsUsed in order to reduce files footprint. Usually used on archives

– Synchronization ToolsSynchronize two directories

Page 3: 12 linux archiving tools

tar• “tar” is a tool that can create and extract archives. This is the

most commonly used archiving tool on Unix and Linux • Syntax:

tar c[options] filename(s) tar x[options]

• Options: c create a new archive x extract an existing archive t list files inside archive f file use file as the archive destination (default is STDIN/STDOUT) v be verbose z use ZIP compression on archive j use BZIP compression on archive

Page 4: 12 linux archiving tools

gzip• “gzip” is a compression tool which is based on the Lempel/Ziv

algorithm for data compression• Syntax:

gzip [options] filename(s)

• Options: -d extract a compressed file in-place (overwrite the original file) -c send output to the STDOUT instead of overwriting the file -N set compression level (1-fast 9-small)

Note: The default action of gzip is to compress a file. gzip can only compress a single file, this usually being used with an archiving tool

Page 5: 12 linux archiving tools

gzip• “gzip” is bounded with some other command line tools which

can help working with compressed files. These are implementations or other basic tools, while adding the compression layer on top of them. zlesszcatzgrepzmore

Page 6: 12 linux archiving tools

rpm• “rpm” is the most fundamental tool for managing special

software package archives. The name stands for Redhat Package Management and the archive format is dedicated to this task.

• Creating rpm archives is usually done by software vendors or distributors.

• Syntax: rpm [options] filename(s)

• Options: -i install a new package -e erase a package

Page 7: 12 linux archiving tools

rpm -v be verbose -h display progress bar hashes -qa query all installed packages on the system -qi package show information on package -ql package show list of all files included in package -qf file show the origin package of file

• Examplesrpm -ivh mySoftware.rpmrpm -e mySoftwarerpm -qi perlrpm -qf /bin/bash

Page 8: 12 linux archiving tools

rsync• “rsync” is a synchronization tool for files and directory

structures in Unix and Linux. It support both local and remote synchronization. After the initial sync, it will only transfer new pieces of data

• Syntax: rsync [options] source destination

• Options: -a archive. preserve permissions, times stamps, etc -z use compression when transferring files -v be verbose

Page 9: 12 linux archiving tools

rsync• Example# ls source/ dest/dest/:source/:file1 file2 file3# rsync -av source/ dest/file1file2file3sent 224 bytes received 72 bytes 197.33 bytes/sec# echo 456 > source/file2 # rsync -av source/ dest/file2sent 131 bytes received 31 bytes 324.00 bytes/sec