Daily Shaarli

All links of one day in a single page.

January 8, 2013

Différences entre "tar ." et "tar *"

~% mkdir temp
~% cd temp
~/temp% echo le fichier caché > .cache
~/temp% echo le fichier normal > normal
~/temp% tar -cvf ~/archive_dossier.tar .
./
./.cache
./normal
~/temp% tar -cvf ~/archive_etoile.tar *
normal

Déjà, on voit que le fichier .cache N'est PAS archivé.

~/temp% tar -tvf ~/archive_dossier.tar
drwxr-x--- thican/thican 0 2013-01-08 19:17 ./
-rw-r----- thican/thican 18 2013-01-08 19:17 ./.cache
-rw-r----- thican/thican 18 2013-01-08 19:17 ./normal
~/temp% tar -tvf ~/archive_etoile.tar
-rw-r----- thican/thican 18 2013-01-08 19:17 normal

Oui, on vient de confirmer que les fichiers cachés NE sont PAS archivés.

Mais il y a autre chose de différent : le dossier actuel.

~/temp% mkdir ~/temp_dossier
~/temp% ls -ld ~/temp_dossier
drwxr-x--- 2 thican thican 6 8 janv. 19:21 ~/temp_dossier/
~/temp% chmod o=rX ~/temp_dossier
~/temp% ls -ld ~/temp_dossier
drwxr-xr-x 2 thican thican 6 8 janv. 19:21 ~/temp_dossier/
~/temp% cd ~/temp_dossier
~/temp_dossier% tar -xvf ~/archive_dossier
./
./.cache
./normal
~/temp_dossier% ls -la
total 12
drwxr-x--- 2 thican thican 32 8 janv. 19:17 ./
drwxr-x--x 16 thican thican 4096 8 janv. 19:22 ../
-rw-r----- 1 thican thican 18 8 janv. 19:17 .cache
-rw-r----- 1 thican thican 18 8 janv. 19:17 normal

Tiens tiens, les droits sur le dossier actuels ont changés !

~/temp_dossier% mkdir ~/temp_etoile
~/temp_dossier% ls -ld ~/temp_etoile
drwxr-x--- 2 thican thican 6 8 janv. 19:23 ~/temp_etoile/
~/temp_dossier% chmod o=rX ~/temp_etoile
~/temp_dossier% ls -ld ~/temp_etoile
drwxr-xr-x 2 thican thican 6 8 janv. 19:23 ~/temp_etoile/
~/temp_dossier% cd ~/temp_etoile
~/temp_etoile% tar -xvf ~/archive_etoile.tar
normal
~/temp_etoile% ls -la
total 8
drwxr-xr-x 2 thican thican 19 8 janv. 19:24 ./
drwxr-x--x 17 thican thican 4096 8 janv. 19:24 ../
-rw-r----- 1 thican thican 18 8 janv. 19:17 normal

Et là non, les droits N'ont PAS changés.

Bref, "tar ." et "tar *" sont bels et biens différents.