Detailed explanation of linux touch command

Release: 2019-10-24 16:12:18
Original
12294 people have browsed it

Detailed explanation of linux touch command

Detailed explanation of linux touch command:

1. Command function:

Time stamp for creating files and modifying files or directories

2. Command syntax:

touch [Option] [File name or directory name]

3. Command parameters:

  • -a Only modify the file Access time.

  • -c or --no-create Do not create files that do not exist.

  • -d uses the specified date and time instead of the current time

  • -m refers to modifying the Modify time without modifying it access (access) time

  • -r file Use the timestamp of the specified file file to update the timestamp of the file (access, modify)

  • Note: access indicates the time when the file was last accessed (only accessed, not changed)

  • modify indicates the time when the file was last modified

  • change indicates the time when the file attributes were last changed, including permissions, size, attributes, etc.

  • -t Modifies the time to the date specified by the parameter, such as: 07081556 represents July 8, 15:56

4. Usage example:

Create a file that does not exist, such as creating it in the /data directory:

Detailed explanation of linux touch command

Modify the access time of the file, such as modifying the access time of westoslinux in the above figure

Detailed explanation of linux touch commandModify the modify time of the file, such as modifying / Modify time of data/westoslinux file

Detailed explanation of linux touch command

Use the specified time to change the access or modify time of the file or directory, for example, modify the access time of the file above to 2012-07-15 08:30:30, to modify the modify timestamp, just change the parameter a to m.

Detailed explanation of linux touch command

The above is the detailed content of Detailed explanation of linux touch command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!