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..
:)
En esta página del sitio puede ver el video en línea Linux/Unix Tutorial for Beginners for tar command de Duración hora minuto segunda en buena calidad , que subió el usuario Coding GuruJi 29 mayo 2019, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 103 veces y le gustó 3 a los espectadores. Disfruta viendo!