Published using Google Docs
introducao
Updated automatically every 5 minutes

Introdução

touch

touch --help

$ touch --help

Uso: touch [OPÇÃO]... ARQUIVO...

Update the access and modification times of each FILE to the current time.

A FILE argument that does not exist is created empty, unless -c or -h

is supplied.

A FILE argument string of - is handled specially and causes touch to

change the times of the file associated with standard output.

Mandatory arguments to long options are mandatory for short options too.

  -a altera somente a hora de acesso

  -c, --no-create não cria nenhum arquivo

  -d, --date=STRING analisa STRING e usa-a ao invés da hora atual

  -f (ignorado)

  -h, --no-dereference afeta cada link simbólico ao invés de qualquer arquivo

                         referenciado (útil somente em sistemas que podem alterar a

                         data/hora de um link simbólico)

  -m altera somente a hora de modificação

  -r, --reference=FILE   use this file's times instead of current time

  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time

      --time=WORD        change the specified time:

                           WORD is access, atime, or use: equivalent to -a

                           WORD is modify or mtime: equivalent to -m

      --help     mostra esta ajuda e finaliza

      --version  informa a versão e finaliza

Note que as opções -d e -t aceitam formatos diferentes de data e hora.

Opções

touch com coringa { }

$ touch arquivo{1,2,3}.txt

$ ls

arquivo1.txt  arquivo2.txt  arquivo3.txt

Alterando data e hora com touch

$ touch -t 203010151100.00 teste.txt

$ stat teste.txt

  File: "teste.txt"

  Size: 0                     Blocks: 0              IO Block: 4096   arquivo comum vazio

Device: 801h/2049d    Inode: 4849683         Links: 1

Access: (0644/-rw-r--r--)  Uid: ( 1000/angelogicus)   Gid: ( 1000/angelogicus)

Access: 2030-10-15 11:00:00.000000000 -0300

Modify: 2030-10-15 11:00:00.000000000 -0300

Change: 2014-10-22 19:48:41.438273397 -0200

 Birth: -

$ touch -t 200112101040.30 -a novo.txt

$ stat novo.txt

  File: "novo.txt"

  Size: 0                     Blocks: 0              IO Block: 4096   arquivo comum vazio

Device: 801h/2049d    Inode: 11272211        Links: 1

Access: (0644/-rw-r--r--)  Uid: ( 1000/  angela)   Gid: ( 1000/  angela)

Access: 2001-12-10 10:40:30.000000000 -0200

Modify: 2014-01-22 16:18:40.566782769 -0200

Change: 2014-01-22 16:18:40.566782769 -0200

 Birth: -

$ touch -t 199901221550.55 -m novo.txt

$ stat novo.txt

  File: "novo.txt"

  Size: 0                     Blocks: 0              IO Block: 4096   arquivo comum vazio

Device: 801h/2049d    Inode: 11272211        Links: 1

Access: (0644/-rw-r--r--)  Uid: ( 1000/  angela)   Gid: ( 1000/  angela)

Access: 2001-12-10 10:40:30.000000000 -0200

Modify: 1999-01-22 15:50:55.000000000 -0200

Change: 2014-01-22 16:21:44.711695893 -0200

 Birth: -


Logicus Tecnologia de Informação e Comunicação http://logicus.com.br atendimento@logicus.com.br