ASP站长网Linux touch命令不仅可以用于在Linux上创建空文件。 您可以使用它来更改现有文件的时间戳,包括其访问权限和修改时间。 本文介绍了8种可以通过Linux终端使用touch命令的方案。
我们在Ubuntu 18.04 LTS/Ubuntu 18.10系统上运行了本文中提到的命令和过程。 由于touch命令是命令行实用程序,因此我们将在本文中使用Ubuntu终端。 您可以通过系统Dash或Ctrl + Alt + T快捷方式打开终端。
linuxidc@linuxidc:~/linuxidc.com$ touch --help
用法:touch [选项]... 文件...
Update the access and modification times of each FILE to the current time.
A FILE argument that does not exist is created empty, unless -c or -h
is supplied.
A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.
必选参数对长短选项同时适用。
-a 只更改访问时间
-c, --no-create 不创建任何文件
-d, --date=字符串 使用指定字符串表示时间而非当前时间
-f (忽略)
-h, --no-dereference 会影响符号链接本身,而非符号链接所指示的目的地
(当系统支持更改符号链接的所有者时,此选项才有用)
-m 只更改修改时间
-r, --reference=FILE use this file's times instead of current time
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time
--time=WORD change the specified time:
WORD is access, atime, or use: equivalent to -a
WORD is modify or mtime: equivalent to -m
--help 显示此帮助信息并退出
--version 显示版本信息并退出
大型站长资讯类网站! https://www.0792zz.cn