s243a

tar command examples (untested)

Mar 16th, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.01 KB | None | 0 0
  1. #Some tar ideas (not tested yet):
  2.  
  3. #If one has a subfolder then rather than:
  4. tar --keep-directory-symlink -xf package.tar -C /
  5. #**--one-top-level[=DIR] option might be able to be used insead of "-C /"
  6. #one can do:
  7. tar --keep-directory-symlink --transform='s%package-name/%%' -xf package.tar -C /
  8. #See: https://www.gnu.org/software/tar/manual/html_section/tar_51.html
  9.  
  10. #Files can also be excluded from a tar archive either by:
  11. cpio -i  --nonmatching='metadata.asc' / < package.tar
  12. # shell patters See: http://man7.org/linux/man-pages/man3/glob.3.html
  13. tar --exclude=PATTERN -xf package.tar -C /
  14.  
  15. #One can put the exclude patterns in a file
  16. tar --exclude-from=FILE -xf package.tar -C /
  17.  
  18. #If a tar archive is concatenated with metadata when one might be able to do sometihng like
  19. tar --transform='s%package-name%%' -x \
  20.   -f <(tar -x  --to-stdout --nonmatching='metadata.asc' -f package.pet.tar) \
  21.   -C /
  22. #or
  23. tar -x --files-from <<<package-name package.tar -C /
  24.  
  25. #or
  26.  
  27. cpio -i  -E 'package-name/*' / < package.tar
Add Comment
Please, Sign In to add comment