Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Chapter 15. Archiving Files

The archiving files chapter provides some basic information on the simple programs that you can use to archive files. You will often see these programs used when you try to install programs without using a package management tool.

This is not a backup guide: Please note that while tar is useful for regular purposes, and possibly combined with bash sciprting or similar it can become useful, it is not a great program for performing real backups of data.

You should try searching the internet if you are looking for backup programs on GNU/Linux or try Sourceforge or Freshmeat for programs that you can use. You may also like to see rsync, the Section called rsync.

tar (tape archiver)

Type tar then -option(s)

Options list:

  • -c --- create.

  • -v --- verbose, give more output, show what files are being worked with (extracted or added).

  • -f --- file (create or extract from file) - should always be the last option otherwise the command will not work.

  • -z --- put the file though gzip or use gunzip on the file first.

  • -x --- extract the files from the tarball.

  • -p --- preserves dates, permissions of the original files.

  • -j --- send archive through bzip2.

  • --exclude=pattern --- this will stop certain files from being archived (using a standard wild-card pattern) or a single file name.

tar examples

 

tar -cvpf name_of_file.tar files_to_be_backed_up

This would create a tape archive (no compressing).

tar -zxvpf my_tar_file.tar.gz

This would extract files (verbosely) from a gzipped tape archive.