theshell.ch/site/pages/fs/touch.html

42 lines
1.3 KiB
HTML

---
layout: page
category-page: fs
category-title: FileSystem
tags: directory list create new file
author: Mattia Hijman
title: touch
previous-page: pages/fs/rm.html
next-page: pages/fs/zip.html
---
The <code>touch</code> command updates the modification and access time of the a file.
If the given file does not exists, it gets created.<br>
<pre>
touch [flags] [file1] [file2] ...
</pre>
<h3>Flags</h3>
<ul>
<li><b>-A</b>: adjust the access and modification timestamps for the file by the
specified value.
</li>
<li><b>-a</b>: Change the access time of the file. The modification time of the
file is not changed unless the -m flag is also specified.
</li>
<li><b>-c</b>: Do not create the file if it does not exist.</li>
<li><b>-f</b> Attempt to force the update, even if the file permissions do not
currently permit it.
</li>
<li><b>-h</b>: If the file is a symbolic link, change the times of the link
itself rather than the file that the link points to.
</li>
<li><b>-m</b>: Change the modification time of the file. The access time of the
file is not changed unless the -a flag is also specified.
</li>
<li><b>-t</b>: Change the access and modification times to the specified time
instead of the current time of day.
</li>
</ul>