Achieving facilities :

The following utilities are used to package files together for storage, convenient moving or other reasons.

  • ar - archive. The archive utility takes a set of files and combines them into a single file with a format that makes it easy for other programs to fetch the individual files (or members) back. ar is used to build programming libraries. Any time you have compiled a program that uses a library for external functions, you have accessed an archive.

    ar does not recognize a directory structure, so you cannot store the contents of a directory tree in an archived file.

  • tar - tape archive. tar is used to back up directories. It can be used to backup or image the whole Unix file-system. By default, tar will attempt to write its output to a default tape drive if creating an archive or read from same tape drive if extracting. So, in most case, you need to indicate a filename for the archive file.

    Create a tar archive.

    tar cvf mydir.tar mydir

    The 1st 3 letters after tar are options, c - create the archive file, v - verbose reporting of archiving process, f mydir.tar - filename of archive destination instead of tape drive. when specifying target directory to archive, the absolute or relative path specified for the target directory will also be stored in the archive.

    Extract a tar archive.

    tar xvf mydir.tar

    The three options are : x - extract the contents, v - verbose messaging, f - file to extract from. When a tape archive is extracted, it will be extracted into and under the current working directory. If an absolute path was used in creating it, tar will create all the directories recorded under the current directory.


    There are many more commands available. Some we will explore when they contribute to a topic being covered. Others, deserve and will get their own modules.

    Command List