Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command touch in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux commonly used command touch how to use, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

The Linux common command touch command is used to modify the time properties of a file or directory, including access time and change time. If the file does not exist, the system will create a new file

Syntax touch [- acfm] [- d] [- r] [- t] [--help] [--version] [file or directory...] Parameter description:

A change the reading time record of the file.

M change the modification time record of the file.

C if the destination file does not exist, no new file will be created. It has the same effect as-no-create.

F is not used and is reserved for compatibility with other unix systems.

R uses the time record of the reference file, which is the same as that of-file.

D set the time and date, you can use a variety of different formats.

T sets the time record of the file in the same format as the date instruction.

-no-create will not create a new file.

-help lists the instruction format.

-version lists version messages.

The instance uses the instruction "touch" to modify the time attribute of the file "testfile" to the current system time, and enter the following command:

$touch testfile # modify the time attribute of the file first, use the ls command to view the properties of the testfile file, as follows:

$ls-l testfile # View the time attribute of the file # the modification time of the original file is 16:09-rw-r--r-- 1 hdd hdd 55 2011-08-22 16:09 after the testfile executes the instruction "touch" to modify the file property, and check the time property of the file again, as follows:

$touch testfile # modify the file time attribute to the current system time $ls-l testfile # View the file's time property # the modified file's time property is the current system time-rw-r--r-- 1 hdd hdd 55 2011-08-22 19:53 when testfile uses the directive "touch", if the specified file does not exist, a new blank file will be created. For example, in the current directory, use this directive to create a blank file "file" and enter the following command:

$touch file # create a new blank document called "file". Thank you for reading this article carefully. I hope the article "how to use touch in Linux" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report