Linux/Unix Tutorial for Beginners for tar command

Опубликовано: 29 Май 2019
на канале: Coding GuruJi
103
3

This tutorial comprises of brief description with real time output of various options of the "tar" command of UNIX.

The various combinations of tar command are as follows :-

1.) Create tar archive file
tar -cvf test.tar /test/
2.) Create tar.gz archive file
tar -cvzf test.tar.gz /test/
3.) Create tar.bz2 archive file
tar -cvfj test.tar.bz2 /test/

4.) Untar a tar archive file in current directory
tar -xvf test.tar
5.) Untar a tar.gz archive file in current directory
tar -xvf test.tar.gz
6.) Untar a tar.bz2 archive file in current directory
tar -xvf test.tar.bz2

7.) List contents of a tar archive file
tar -tvf test.tar
8.) List contents of a tar.gz archive file
tar -tvf test.tar.gz
9.) List contents of a tar.bz2 archive file
tar -tvf test.tar.bz2

10.) Untar single file from a tar file
tar -xvf test.tar test_code.java
11.) Untar single file from a tar,gz file
tar -zxvf test.tar.gz test_code.java
12.) Untar multiple files from tar, tar.gz and tar.bz2 file :-
tar -xvf test.tar "file_1" "file_2"
tar -zxvf test.tar.gz "file_1" "file_2"
tar -jxvf test.tar.bz2 "file_1" file_2"
13.) Extract group of files using wildcard
tar -xvf test.tar --wildcards "*.java"
tar -zxvf test.tar.gz --wildcards "*.java"
tar -jxvf test.tar.bz2 --wildcards "*.java"
14.) Add files or directories to tar archive file
tar -rvf test.tar temp
N.B- The tar -rvf options works only for .tar files and will show errors for .tar.gz and .tar.bz2

15.) To check the size of a tar, tar.gz, tar.bz2 archive file
tar -czf - test.tar | wc -c

16. ) To create a tar.gz file file with destination path on a different machine or server
tar zcvf - test | ssh root@192.168.0.4 "cat greater_than_sign /tempo/testing.tar.gz"
17.) To untar a tar.gz file to a different destination machine or server.
cat testing.tar.gz | ssh root@192.168.0.4 "cd /test/; tar zxvf -"

Please ignore in case of a typo in the description part and refer to the video..
:)


На этой странице сайта вы можете посмотреть видео онлайн Linux/Unix Tutorial for Beginners for tar command длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Coding GuruJi 29 Май 2019, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 103 раз и оно понравилось 3 зрителям. Приятного просмотра!