Advertisement
metalx1000

tar gz quick notes

Sep 30th, 2023 (edited)
1,564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. #tar a directory
  2. tar -cvf projects.tar /usr/local/bin
  3.  
  4. #extract all files
  5. tar -xf projects.tar
  6.  
  7. #tar and compress a directory
  8. tar -czvf projects.tar.gz /usr/local/bin
  9.  
  10. #list content
  11. tar -tvf projects.tar.gz
  12.  
  13. #search for files
  14. tar -tvf projects.tar.gz --wildcards '*yt*'
  15.  
  16.  
  17. #extract a single file
  18. tar -zxvf <tar filename> <file you want to extract>
  19. tar -zxvf projects.tar.gz "usr/local/bin/ytplay"
  20.  
  21. #extract multiple files with wildcards
  22. tar -zxvf projects.tar.gz --wildcards "*ytplay*"
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement