File compression and archiving and transfer with permission

File archiving is to combine multiple files into one packaged file, commonly known as packaging

tar c create

         f specify the archive file name


   

 t ## show the contents of the archive


The parameter tf is followed by the file name

    r ##Add files to archive


    --get ##Get a single file


    --delete ##Delete a single file


    x ## Extract everything from the archive


    -C ##Specify the unarchive directory

    -z ##gz format compression


    -j ##bz2 format compression


    -J ##xz format compression

####2.compression####
gz
gzip etc.tar ##compress into gz format

gunzip etc.tar.gz ##Decompress the gz format compressed package


tar zcf etc.tar.gz /etc ##Archive the file as tar and compress it into gz
tar zxf etc.tar.gz ##Unzip and unarchive the gz format compressed package

bz2
bzip2 etc.tar ##Compress into bz2 format

bunzip2 etc.tar.bz2 ##Unzip bz2 format compressed package


tar jcf etc.tar.bz2 /etc ##Archive the file as tar and compress it into bz2
tar jxf etc.tar.bz2 ##Unzip and unarchive the bz2 format compressed package

xz
xz etc.tar ##Compress into xz format

unxz etc.tar.xz ##Decompress the xz format compressed package


tar Jcf etc.tar.xz /etc ##Archive the file as tar and compress it into zx

tar Jxf etc.tar.xz ##Unzip and unarchive xz format compressed package



zip

zip -r etc.tar.zip etc.tar ##Compress into zip format
unzip etc.tar.zip ##Decompress zip format compressed package


####3. File transfer in the system####

scp file username@ip:/dir ##Upload


scp username@ip:/dir/file /dir ##download

rsync [parameter] file username@ip:/dir

rsync -r ##Sync directory


  

  -l ## do not ignore links



    -p ##Do not ignore file permissions



    -t ##Do not ignore file timestamps


g ##Do not ignore all groups of files

    -o ##Do not ignore the owner of the file


    -D ## do not ignore device files

ln -s file directory ##Link file and directory



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325970604&siteId=291194637
Recommended