linux:tar
This is an old revision of the document!
tar -flags dest_file_name source_file_or_dir
| Example | Explanation / Remarks |
|---|---|
| tar -czvf /home/user/dest_backup.tgz /var/www/source_dir/*.html | compress all files in source directory into the specified dest file |
| tar -xzvf /home/user/backup_file.tgz /var/www/dest_dir/*.html | extract files in source file into the specified dest directory(??) |
| find /var/log -iname '2022-06*.log' -print0 | tar -cvf /var/bu/june.tar –null -T - | using find |
| Flag | Same as | Explanation / Remarks |
|---|---|---|
| c | create a new archive file | |
| z | use gzip compress or uncompress | |
| v | verbose output - show details while running | |
| f | next parameter is the filename | |
| x | extract compressed file | |
| t | –list | list contents of file |
| r | –append | append file(s) to tar file |
| - | dash, as last symbol → use stdin as input. usually, together with another program like find |
linux/tar.1654494171.txt.gz · Last modified: 2022/06/06 05:42 by levor
