1.6 KiB
TAR
Создать архив
tar -cvf archivename.tar /files-you-want-toarchive
-c, --create create a new archive -v, --verbose verbosely list files processed -f, --file=ARCHIVE use archive file or device ARCHIVE
Создать архив со сжатием
tar -czvf archivename.tar.gz /files-you-want-toarchive
-j, --bzip2 filter the archive through bzip2 -J, --xz filter the archive through xz -z, --gzip, --gunzip, --ungzip filter the archive through gzip
Добавить файл в существующий архив
tar -rvf /root/homes.tar /etc/hosts
-r, --append append files to the end of an archive
Обновить файлы в существующем архиве
tar -uvf /root/homes.tar /home
-u, --update only append files newer than copy in archive
Просмотр содержимого архива
tar -tvf /root/homes.tar
-t, --list list the contents of an archive
Извлечь файлы из архива в текущий каталог
tar -xvf /archivename
-x, --extract, --get extract files from an archive
Извлечь файлы из сжатого архива
tar -xzvf archivename.tar.gz
Извлечь файлы из архива в другой каталог
tar -xvf /archivename -C /tmp
-C, --directory=DIR change to directory DIR
Извлечь определённый файл из архива
tar -xvf /root/etc.tar etc/hosts