To back up data today, run the tar command.
Compression command:
Tar-zvvf ticket-data-intgration.tar.gz ticket-data-intgration
Compressed but does not contain a folder
Tar -- exclude/home/Q/ticket-data-intgration/log -- exclude/home/Q/ticket-data-intgration/cache-zvvf ticket-data-intgration.tar.gz/home/Q/ticket-Data -intgration
View tar package files
Tar-tzvf ticket-data-intgration.tar.gz
Error:/bin/tar: removing leading '/' from Member names
In Linux, absolute paths are generally not recommended when tar is used to package files. If no parameter is specified during absolute path packaging, tar generates a warning message: "Tar: removing leading '/' from Member names ", in addition, the actual compressed package will convert the absolute path to the relative path. For example:
[email protected] ~ # tar -czvf robin.tar.gz /home/robintar: Removing leading `/‘ from member names/home/robin//home/robin/file1/home/robin/file2/home/robin/file3[email protected] ~ # tar -tzvf robin.tar.gzdrwxr-xr-x robin/root 0 2009-11-10 18:51:31 home/robin/-rw-r--r-- robin/root 0 2009-11-10 18:51:28 home/robin/file1-rw-r--r-- robin/root 0 2009-11-10 18:51:30 home/robin/file2-rw-r--r-- robin/root 0 2009-11-10 18:51:31 home/robin/file3[email protected] ~ #
If we unbind such a compressed package, the current directory (that is, "~" in this example) will be displayed. And then create the "./home/Robin/" directory. For such a compressed package, the decompression method is to use the "-c" parameter to indicate that the extracted directory is the root directory ("/"): tar-xzvf pai.tar.gz-C/
The more convenient method is to use the parameter-P during packaging and unbundling:
[email protected] ~ # tar -czvPf robin.tar.gz /home/robin//home/robin//home/robin/file1/home/robin/file2/home/robin/file3[email protected] ~ # tar tzvf robin.tar.gzdrwxr-xr-x robin/root 0 2009-11-10 18:51:31 /home/robin/-rw-r--r-- robin/root 0 2009-11-10 18:51:28 /home/robin/file1-rw-r--r-- robin/root 0 2009-11-10 18:51:30 /home/robin/file2-rw-r--r-- robin/root 0 2009-11-10 18:51:31 /home/robin/file3[email protected] ~ # tar -xzvPf robin.tar.gz/home/robin//home/robin/file1/home/robin/file2/home/robin/file3[email protected] ~ #
Note: The upper-P Case and position cannot be changed.