1. Archive
1. File archiving is to turn multiple files into one archive file
2. Command: tar c ##create
f ## Specify the archive file name
(Create a file archive file and archive file1 and file2 in the file)
t ##Display the contents of
the archive r ##Add a file to the archive
--get ##Remove a single file
--delete ##Delete a single file
x ##Remove all content in the archive
-C ##Specify the solution file directory
-z ##gz format compression
-j ##bz2 format compression
-J ##xz format compression
2. Compression
gz
gzip file2.tar ##compress into gz format
gunzip file2.tar.gz ##Decompress the gz format compressed package
tar zcf file1.tar.gz /etc ##Archive the file as tar and compress it into gz
tar zxf file1.tar.gz ##Unzip and extract gz format compressed package
bz2
bzip2 etc.tar ##Compress into bz2 format
bunzip2 etc.tar.bz2 ##Unzip the bz2 format compressed package
tar jcf etc.tar.bz2 /etc ##Archive the file into 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 ##Unzip the xz format compressed package
tar Jcf etc.tar.xz /etc ##Archive the file as tar and compress 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 ##Unzip zip Format compressed package
3. File transfer in the system
scp file username@ip:/dir ##Upload
scp username@ip:/dir/file /dir ##download
rsync [parameters] 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 file ownership group
-o ## do not ignore the owner of the file
-D ## do not ignore device files
For example: rsync -r dir [email protected]:/mnt/