When creating an archive with the command
tar -czvf file.txt.tar.gz /tmp/file.txt
in the archive, the file will also be located along the path
Is it possible to somehow set your own directory structure inside the archive in the parameters? So that, for example, there was not
/tmp/file.txt , but
Answer # 1
GNU tar has an option
/var /tmp /x $ tar czf a.tgz -P --owner= 0 --group= 0 --xform s ~ tmp ~ home /vasya ~ /tmp/file.txt /var /tmp /x $ tar tvf a.tgz -P -rw-rw-r--root /root 0 2021-02-10 16:38 /home/vasya/file.txt
- linux : Copy files by mask from different folders
- linux : How to delete all input after READ command in Bash?
- linux : How to get a refund code from the conveyor in the same conveyor?
- Bash Linux script
- linux : Creating a label in xfce
- linux : How to redistribute disk space on the CENTOS virtual server?
- linux : Regular expression does not work properly in Bash
- linux : I want to display the calculation result which the result is a decimal decimal |
- linux : How to transfer a dynamic parameter via Unit Systemd to execute in Bash script