Include hidden files in a tar

1

I need a command that can include hidden files within a tar.gz Until now I use

$ tar -zcvf respaldo.tar.gz /var/www/sitio.com/

But this does not store hidden files like .htaccess How can I include these files in a similar command?

    
asked by akko 25.11.2017 в 20:02
source

1 answer

1

If the hidden files are recorded !!!

Example: I create a test folder, I sit inside and create 2 files (visible and hidden):

$ mkdir -p /tmp/prueba
$ cd /tmp/prueba
$ touch fichero_normal .fichero.oculto
$ ls
fichero_normal

luisgulo@mitnick:/tmp/prueba$ ls -la
total 68
drwxr-xr-x  2 luisgulo tic-servinf  4096 nov 30 12:34 .
drwxrwxrwt 18 root     root        65536 nov 30 12:34 ..
-rw-r--r--  1 usuario grupo     0 nov 30 12:34 fichero_normal
-rw-r--r--  1 usuario grupo     0 nov 30 12:34 .fichero.oculto

I place myself before the directory to be saved and I make a tar of it. You can see in the output of the execution that the hidden files are being stored.

$ cd ..
$ tar cvfp prueba.tar prueba
prueba/
prueba/.fichero.oculto
prueba/fichero_normal
    
answered by 30.11.2017 в 12:46