2018-11-19 12:29:19 +00:00
|
|
|
---
|
|
|
|
layout: page
|
|
|
|
category-page: fs
|
|
|
|
category-title: FileSystem
|
2018-11-19 14:57:49 +00:00
|
|
|
tags: directory list create new file
|
2018-11-19 12:29:19 +00:00
|
|
|
author: Mattia Hijman
|
2018-11-19 12:35:31 +00:00
|
|
|
title: touch
|
2018-11-19 12:29:19 +00:00
|
|
|
previous-page: pages/fs/rm.html
|
|
|
|
---
|
|
|
|
|
2018-11-19 14:57:49 +00:00
|
|
|
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>
|
|
|
|
|
2018-11-19 12:29:19 +00:00
|
|
|
<pre>
|
2018-11-19 14:57:49 +00:00
|
|
|
touch [flags] [file1] [file2] ...
|
2018-11-19 12:29:19 +00:00
|
|
|
</pre>
|
|
|
|
|
2018-11-19 14:57:49 +00:00
|
|
|
<h3>Flags</h3>
|
2018-11-19 12:29:19 +00:00
|
|
|
|
|
|
|
<ul>
|
2018-11-19 14:57:49 +00:00
|
|
|
<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>
|