Linux touch command


  Translation results:

touch

English[tʌtʃ] US[tʌtʃ]

vt. To touch; to bring something into light contact with...; to eat or drink, to taste; [ Number] tangent to...

n.Touch, touch; touch, touch; modification, polish; trace

vi.Contact; contact

Third person singular: touches plural : touches Present participle: touching Past tense: touched Past participle: touched

Linux touch commandsyntax

Function: The touch command is used to modify the time attributes of files or directories, including access time and change time.

Syntax: touch [-acfm][-d<date time>][-r<reference file or directory>] [-t<date time>][- -help][--version][file or directory...]

Linux touch commandexample

Use the command "touch" to modify the time attribute of the file "testfile" to the current system time. Enter the following command:

$ touch testfile                #修改文件的时间属性

First, use the ls command to view the attributes of the testfile file, as follows:

$ ls -l testfile                #查看文件的时间属性  
#原来文件的修改时间为16:09  
-rw-r--r-- 1 hdd hdd 55 2011-08-22 16:09 testfile

After executing the command "touch" to modify the file attributes, check the time attribute of the file again, as shown below:

$ touch testfile                #修改文件时间属性为当前系统时间  
$ ls -l testfile                #查看文件的时间属性  
#修改后文件的时间属性为当前系统时间  
-rw-r--r-- 1 hdd hdd 55 2011-08-22 19:53 testfile

When using the command "touch", if the specified file does not exist, it will Create a new blank file. For example, use this command to create a blank file "file" in the current directory and enter the following command:

$ touch file            #创建一个名为“file”的新的空白文件

Popular Recommendations

Home

Videos

Q&A