Truque com comando 'ls'

Pergunta Chave: Como Descobrir a hora ou horário de criação e modificação de um arquivo?

Com o comando 'ls', comando básico do GNU/Linux, é possível.


-l use a long listing format
--full-time like -l --time-style=full-iso
-t sort by modification time
-c with -lt: sort by, and show, ctime (time of last
modification of file status information)
with -l: show ctime and sort by name
otherwise: sort by ctime


Exemplos:
ls -l
drwxrwxr-x 2 apache spmulheres 4096 Set 1 2010 APP_SIAM
drwxrwxr-x 2 apache spmulheres 4096 Jan 14 09:16 DUMP_SIAM
drwxrwxr-x 10 apache spmulheres 4096 Out 1 2010 homologa
drwxrwxr-x 10 apache spmulheres 4096 Set 1 2010 homologa_27082010
drwxrwxr-x 9 apache spmulheres 4096 Set 6 2010 spmu
drwxrwsr-x 10 apache spmulheres 4096 Out 27 2010 spmu_prod
drwxrwsr-x 9 apache spmulheres 4096 Jan 28 15:30 spmu_prod_1359393835


ls -lt
total 48
drwxrwsr-x 9 apache spmulheres 4096 Jan 28 15:30 spmu_prod_1359393835
drwxrwxr-x 2 apache spmulheres 4096 Jan 14 09:16 DUMP_SIAM
drwxrwsr-x 10 apache spmulheres 4096 Out 27 2010 spmu_prod
drwxrwxr-x 10 apache spmulheres 4096 Out 1 2010 homologa
drwxrwxr-x 9 apache spmulheres 4096 Set 6 2010 spmu
drwxrwxr-x 2 apache spmulheres 4096 Set 1 2010 APP_SIAM
drwxrwxr-x 10 apache spmulheres 4096 Set 1 2010 homologa_27082010


ls -lt --full-time
drwxrwsr-x 9 apache spmulheres 4096 2013-01-28 15:30:07.000000000 -0200 spmu_prod_1359393835
drwxrwxr-x 2 apache spmulheres 4096 2013-01-14 09:16:02.000000000 -0200 DUMP_SIAM
drwxrwsr-x 10 apache spmulheres 4096 2010-10-27 09:17:23.000000000 -0200 spmu_prod
drwxrwxr-x 10 apache spmulheres 4096 2010-10-01 10:33:42.000000000 -0300 homologa
drwxrwxr-x 9 apache spmulheres 4096 2010-09-06 13:42:52.000000000 -0300 spmu
drwxrwxr-x 2 apache spmulheres 4096 2010-09-01 13:36:24.000000000 -0300 APP_SIAM
drwxrwxr-x 10 apache spmulheres 4096 2010-09-01 13:36:24.000000000 -0300 homologa_27082010

ls -ltc --full-time
total 48
drwxrwsr-x 9 apache spmulheres 4096 2013-01-28 15:30:07.000000000 -0200 spmu_prod_1359393835
drwxrwsr-x 10 apache spmulheres 4096 2013-01-14 09:38:49.000000000 -0200 spmu_prod
drwxrwxr-x 2 apache spmulheres 4096 2013-01-14 09:16:02.000000000 -0200 DUMP_SIAM
drwxrwxr-x 2 apache spmulheres 4096 2010-12-15 09:39:40.000000000 -0200 APP_SIAM
drwxrwxr-x 10 apache spmulheres 4096 2010-12-15 09:39:40.000000000 -0200 homologa
drwxrwxr-x 10 apache spmulheres 4096 2010-12-15 09:39:39.000000000 -0200 homologa_27082010
drwxrwxr-x 9 apache spmulheres 4096 2010-12-15 09:39:39.000000000 -0200 spmu

Comentários