The TAR command uses
The default tar has only the archive function, no compression function
tar [option ...] [File] ...
-c,--create Create
-x,--extract,--get Decompression
-t,--list viewing the contents of an archive file
-F,--file archive name
-v,--verbose Show details of the archive
-P,--preserve reserved permissions
The commonly used compression tools are:
Gzip xxx.tar.gz
Bzip2 xxx.tar.bz
[Email protected] ~]# mkdir/Pub [[email protected]~]# CD/Pub[[email protected] pub]# CP/etc/passwd. [email protected] pub]# CP/etc/Shadow. [[email protected] pub]# lspasswd shadow[[email protected] pub]# tar CF pa.tar passwd shadow [[email protected] pub]# ls passwd Pa.tar shadow[[email protected] pub]# tar tf pa.tar passwdshadow[[email protected] pub]# tar czvf pa.tar.gz PASSW D shadow passwdshadow[[email protected] pub]# tar cjvf pa.tar.bz2 passwd shadow Passwdshadow[[email protected] pub]# LSP ASSWD Pa.tar pa.tar.bz2 pa.tar.gz shadow[[email protected] pub]# RM passwd Shadow rm:remove regular file ' passwd ' ?yrm:remove regular file ' shadow '?Y[[email protected] pub]# Lspa.tar pa.tar.bz2 pa.tar.gz[[email protected] pub]# tar xvzf pa.tar.gz passwdshadow[[em AIL protected] pub]# tar xvzf pa.tar.gz passwd #只是提取passwd文件passwd
Archive based on date:
" 2011/02/09 " -CZVF home.tar.gz/home
than 2011/02/09 new files will be backed up
Back up the/etc/directory, but/ETC/PASSWD does not archive
[Email protected] pub]# tar--exclude/etc/passwd-zcvf etc.tar.gz/etc
The default is to extract to the current directory
Unzip to the/tmp/directory using-c:
[Email protected] pub]# tar xvf pa.tar-c/Tmppasswdshadow
Remote Copy command:
SCP
rsync: Incremental Copy
RHCE7 Manage I-12 archive files and copy files between Linux systems