For faster navigation, this Iframe is preloading the Wikiwand page for touch (Unix).

touch (Unix)

此条目需要补充更多来源。 (2012年7月14日)请协助补充多方面可靠来源改善这篇条目无法查证的内容可能会因为异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:"Touch (Unix)"网页新闻书籍学术图像),以检查网络上是否存在该主题的更多可靠来源(判定指引)。

touch是一个被用于更改文件访问和修改时间的标准UNIX程序,它也被用于创建新文件。

历史

[编辑]

touch程序最早出现在第七版AT&TUNIX,包含在GNU核心工具组的touch程序的作者为Paul Rubin,Arnold Robbins,Jim Kingdon,David MacKenzie。

使用方法

[编辑]

单一UNIX规范包含下列程序选项:

-a,只更改访问时间
-c,如果文件不存在,不创建且不声明
-m,只更改修改时间
-r file,使用file的访问、修改时间而非当前时间
-t time,使用time(格式见下)更改访问、修改时间

time的格式为[[cc]yy]MMDDhhmm[.ss],其中cc代表世纪,yy代表年份的后二位数字,MM代表月份,DD代表天数,hh代表小时,mm代表分钟,ss代表秒数。

其他Unix系统或类Unix系统可能添加额外的选项。

示例

[编辑]

以当前时间更改访问、修改时间:

$ touch myfile.txt

注意:touch不修改myfile.txt内容,只更改它的访问、修改时间,如果myfile.txt不存在,它会被创建。

用指定时间更改访问、修改时间:

$ touch -t 200701310846.26 index.html
$ touch -d '2007-01-31 8:46:26' index.html
$ touch -d 'Jan 31 2007 8:46:26' index.html

其他操作系统

[编辑]

其他操作系统,如(Windows、Mac OS)也存在执行相似功能的软件:

参看

[编辑]

外部链接

[编辑]

文档

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
touch (Unix)
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?