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..
:)
In questa pagina del sito puoi guardare il video online Linux/Unix Tutorial for Beginners for tar command della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Coding GuruJi 29 maggio 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 103 volte e gli è piaciuto 3 spettatori. Buona visione!