Most popular archiving tool used in Unix and Linux is the tar command.

The tar command was originally used to write files to a tape device for archiving. However, it can also write the output to a file, which has become a popular way to archive data in Linux.

-c –create create a new archive
-d –diff, –compare find differences between archive and file system
–delete delete from the archive (not for use on mag tapes!)
-r –append append files to the end of an archive
-t –list list the contents of an archive
-u –update only append files that are newer than copy in archive
-x –extract, –get extract files from an archive

tar command is a simple way to create archive files of entire directory structures. This is a common method for distributing source code files for open source applications in the Linux world.


The zip utility

The zip utility

The zip utility there are four utilities in the Linux zip package:

zip creates a compressed file containing listed files and directories.
zipcloak creates an encrypted compress file containing listed files and directories.
zipnote extracts the comments from a zip file.
zipsplit splits a zip file into smaller files of a set size (used for copying large zip files to floppy disks).
unzip extracts files and directories from a compressed zip file.

$ zip
Copyright (c) 1990-2006 Info-ZIP - Type ‘zip “-L”‘ for software license.
Zip 2.32 (June 19th 2006). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]

The gzip utility

By far the most popular file compression utility in Linux is the gzip utility. The gzip package
is a creation of the GNU Project, in their attempt to create a free version of the original Unix
compress utility. This package includes the files.

gzip for compressing files
gzcat for displaying the contents of compressed text files
gunzip for uncompressing files

These utilities work the same way as the bzip2 utilities:

The gzip command compresses every file in the directory that matches the wildcard pattern.


The bzip2 utility

The bzip2 utility

The bzip2 utility is a relatively new compression package that is gaining popularity, especially
when compressing large binary files. The utilities in the bzip2 package are:

bzip2 for compressing files
bzcat for displaying the contents of compressed text files
bunzip2 for uncompressing compressed .bz2 files
bzip2recover for attempting to recover damaged compressed files

By default, the bzip2 command attempts to compress the original file, and replaces it with the
compressed file, using the same filename with a .bz2 extension:

$ bzip2 iptables
$ ls -l iptables*
-rw-r–r– 1 buddy buddy 1477 Dec 15 16:48 iptables.bz2

The GNU long parameters

The GNU long parameters

You can combine GNU long parameters with either Unix- or BSD-style parameters to really customize your display. One cool feature of GNU long parameters with the –forest parameter. It displays the hierarchical process information, but using ASCII characters to draw cute charts:

$ ps -ef –forest |grep apache2

root 3420 1 2 08:55 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 3428 3420 0 08:55 ? 00:00:00 \_ /usr/sbin/apache2 -k start
www-data 3431 3420 0 08:55 ? 00:00:00 \_ /usr/sbin/apache2 -k start
www-data 3432 3420 0 08:55 ? 00:00:00 \_ /usr/sbin/apache2 -k start
www-data 3433 3420 0 08:55 ? 00:00:00 \_ /usr/sbin/apache2 -k start
www-data 3434 3420 0 08:55 ? 00:00:00 \_ /usr/sbin/apache2 -k start

« Prev - Next »