Linux Touch Learning

Source: Internet
Author: User

Linux Touch Command Learning

Touch meaning: Creating files and modifying files

Touch format: Touch [options] file-list

Parameters

file-list is the file path name that touch will create or update

Options

-A only updates the access time and does not change the modification time

-C does not create files that do not exist

-M only updates the modification time, does not change the access time

-r file time to update files using file files

-T modifies the time to the date specified by the parameter, such as: 07081556 for July 8 15:56

Example

Touch Update already has file time

LS-:touchls-: £firefox_wallpaper.png    

Touch no option to update the file's modification time and access time at the same time

Touch Create File

Touchls-:demo.c  

touch-at Update access time with parameters

First look at the original modified time and access time, Ls-lu to see the access time

LS-all:wuyils-: £hs_err_pid2874.log    

Next is the modified time and access time after the update.

01081010LS-£ º------hs_err_pid2874.log     

As you can see, the modification time is not changed, but the access time changes

touch-m Update modification time only

$LS-L Total Dosage68-rw-r--r--1 Siu Siu66350 December2316:51 Hs_err_pid2874.log $ touch-m Hs_err_pid2874.log $ ls-l total usage 68-rw-r--r-- Span style= "COLOR: #800080" >1 Siu siu 66350 January 8 15:31 hs_err_pid2874.log$ ls-lu total usage 68-rw-r--r--1 Siu siu 8 10:10 hs_err_pid2874.log       

As the above example shows, the access time here has not changed and the change time has changed

Tips

1. You can use the default current time to update the file's access time and modification time, or you can specify parameters to update

2. In general, the most place to touch is to create a new file

Linux Touch Learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.