old-www/LDP/GNU-Linux-Tools-Summary/html/c9978.htm

393 lines
5.1 KiB
HTML

<HTML
><HEAD
><TITLE
>Archiving Files</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GNU/Linux Command-Line Tools Summary"
HREF="book1.htm"><LINK
REL="PREVIOUS"
TITLE="File Permissions"
HREF="x9543.htm"><LINK
REL="NEXT"
TITLE="rsync"
HREF="x10099.htm"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>GNU/Linux Command-Line Tools Summary</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x9543.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x10099.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="BACKING-UP-FILES"
></A
>Chapter 15. Archiving Files</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="c9978.htm#TAR"
>tar (tape archiver)</A
></DT
><DT
><A
HREF="x10099.htm"
>rsync</A
></DT
><DT
><A
HREF="x10181.htm"
>Compression</A
></DT
></DL
></DIV
><P
>The archiving <A
NAME="AEN9981"
></A
>files chapter provides <A
NAME="AEN9983"
></A
>some basic <A
NAME="AEN9985"
></A
>information <A
NAME="AEN9987"
></A
>on the simple programs <A
NAME="AEN9989"
></A
>that you can use to archive <A
NAME="AEN9991"
></A
>files. You will often see these programs <A
NAME="AEN9993"
></A
>used when you try to install <A
NAME="AEN9995"
></A
>programs without using a package management<A
NAME="AEN9997"
></A
> tool.</P
><DIV
CLASS="NOTE"
><BLOCKQUOTE
CLASS="NOTE"
><P
><B
>This is not a backup guide: </B
>Please note that while <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>tar</I
></SPAN
> 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.</P
><P
>You should try searching the internet if you are looking for backup programs on GNU/Linux or try <A
HREF="http://sourceforge.net"
TARGET="_top"
>Sourceforge</A
><A
NAME="AEN10005"
></A
> or <A
HREF="http://freshmeat.net"
TARGET="_top"
>Freshmeat</A
><A
NAME="AEN10008"
></A
> for programs that you can use. You may also like to see rsync<A
NAME="AEN10010"
></A
>, <A
HREF="x10099.htm"
>the Section called <I
>rsync</I
></A
>.</P
></BLOCKQUOTE
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="TAR"
></A
>tar (tape archiver)</H1
><P
>Type <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>tar</I
></SPAN
> then <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-option(s)</I
></SPAN
></P
><P
>Options list:<A
NAME="AEN10019"
></A
></P
><P
></P
><UL
><LI
><P
>-c<A
NAME="AEN10024"
></A
> --- create.</P
></LI
><LI
><P
>-v<A
NAME="AEN10028"
></A
> --- verbose,<A
NAME="AEN10030"
></A
> give more output,<A
NAME="AEN10032"
></A
> show <A
NAME="AEN10034"
></A
>what files are being worked with (extracted or added).</P
></LI
><LI
><P
>-f<A
NAME="AEN10038"
></A
> --- file (create or extract <A
NAME="AEN10040"
></A
>from file) - should always be the last option otherwise the command will not work. </P
></LI
><LI
><P
>-z<A
NAME="AEN10044"
></A
> --- put the file though gzip <A
NAME="AEN10046"
></A
>or use gunzip <A
NAME="AEN10048"
></A
>on the file first.</P
></LI
><LI
><P
>-x<A
NAME="AEN10052"
></A
> --- extract the files from the tarball.<A
NAME="AEN10054"
></A
></P
></LI
><LI
><P
>-p<A
NAME="AEN10058"
></A
> --- preserves <A
NAME="AEN10060"
></A
>dates,<A
NAME="AEN10062"
></A
> permissions of the original <A
NAME="AEN10064"
></A
>files.</P
></LI
><LI
><P
>-j<A
NAME="AEN10068"
></A
> --- send <A
NAME="AEN10070"
></A
>archive through bzip2.<A
NAME="AEN10072"
></A
></P
></LI
><LI
><P
>--exclude=pattern<A
NAME="AEN10076"
></A
> --- this will stop <A
NAME="AEN10078"
></A
>certain files from being archived <A
NAME="AEN10080"
></A
>(using a standard wild-card<A
NAME="AEN10082"
></A
> pattern) or a single file name.</P
></LI
></UL
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>tar&nbsp;examples</DT
><DD
><P
>&nbsp;</P
><PRE
CLASS="SCREEN"
>tar -cvpf name_of_file.tar files_to_be_backed_up</PRE
><P
>This would create a tape <A
NAME="AEN10091"
></A
>archive (no compressing).</P
><PRE
CLASS="SCREEN"
>tar -zxvpf my_tar_file.tar.gz</PRE
><P
>This would extract files (verbosely) from a gzipped <A
NAME="AEN10095"
></A
>tape <A
NAME="AEN10097"
></A
>archive.</P
></DD
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x9543.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x10099.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>File Permissions</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>rsync</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>