{"id":2407,"date":"2012-08-31T09:41:54","date_gmt":"2012-08-31T07:41:54","guid":{"rendered":"http:\/\/blog.unelink.es\/?p=2407"},"modified":"2018-05-07T08:44:19","modified_gmt":"2018-05-07T06:44:19","slug":"cambiar-en-linux-la-fecha-y-la-hora-de-un-fichero","status":"publish","type":"post","link":"https:\/\/hosting.airetech.es\/blog\/wiki\/cambiar-en-linux-la-fecha-y-la-hora-de-un-fichero\/","title":{"rendered":"Cambiar en Linux la fecha y la hora de un fichero"},"content":{"rendered":"<p>Si necesitamos cambiar la fecha y hora de creaci\u00f3n de un fichero en Linux, podemos utilizar el comando<\/p>\n<pre>touch<\/pre>\n<p>Vamos a realizar un ejemplo donde cambiaremos la fecha y la hora de un fichero llamado \"test.txt\" alojado en el directorio \"tmp\". Si consultamos la fecha del fichero vemos que es del 31 de agosto a las 11.32 horas:<\/p>\n<pre>root@test:\/tmp# ls -lt\r\ntotal 1\r\n-rw-r--r-- 1 root root 5 <strong>Aug 31 11:32<\/strong> test.txt<\/pre>\n<p>Vamos a cambiar la fecha y hora del archivo a las 9.25 del 30 de agosto. Para ello usaremos el comando touch con el par\u00e1metro -t. El formato que usaremos ser\u00e1 de yyyy\/mm\/dd\/hh\/mm (a\u00f1o, mes, d\u00eda, hora y segundos):<\/p>\n<pre>touch -t\u00a0yyyymmddhhmm test.txt<\/pre>\n<p>El comando para nuestro ejemplo quedar\u00eda as\u00ed:<\/p>\n<pre>touch -t\u00a0201208300925 test.txt<\/pre>\n<p>Y una vez ejecutado, nuestro fichero tendr\u00e1 los nuevos valores:<\/p>\n<pre>root@test:\/tmp# ls -lt\r\ntotal 1\r\n-rw-r--r-- 1 root root 5 <strong>Aug 30 09:25<\/strong> test.txt<\/pre>\n<p>El comando touch admite m\u00e1s par\u00e1metros y permite realizar otras acciones. Si quieres saber m\u00e1s, te recomendamos que consultes el manual en tu consola:<\/p>\n<pre>man touch<\/pre>\n","protected":false},"excerpt":{"rendered":"Si necesitamos cambiar la fecha y hora de creaci\u00f3n de un fichero en Linux, podemos utilizar el comando touch Vamos a realizar un ejemplo donde cambiaremos la fecha y la hora de un fichero llamado \"test.txt\" alojado en el directorio \"tmp\". Si consultamos la fecha del fichero vemos que es del 31 de agosto a las 11.32 horas: root@test:\/tmp# ls&nbsp;<a href=\"https:\/\/hosting.airetech.es\/blog\/wiki\/cambiar-en-linux-la-fecha-y-la-hora-de-un-fichero\/\" class=\"read-more\">Seguir leyendo<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,6],"tags":[179,216],"class_list":["post-2407","post","type-post","status-publish","format-standard","hentry","category-linux","category-wiki","tag-comando-touch","tag-linux","cat-10-id","cat-6-id"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/2407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/comments?post=2407"}],"version-history":[{"count":3,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/2407\/revisions"}],"predecessor-version":[{"id":6880,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/2407\/revisions\/6880"}],"wp:attachment":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/media?parent=2407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/categories?post=2407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/tags?post=2407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}