Self-study linux shell3.4-file processing command touch CP MV RM

Source: Internet
Author: User
Tags set time touch command

Click Back to learn the path of the Linux command line and shell script

3.4-File Processing command touch CP MV RM 1. touch命令
    • 一是用于把已存在文件的时间标签更新为系统当前的时间(默认方式),它们的数据将原封不动地保留下来;
    • 二是用来创建新的空文件。

Touch (options) (parameters)

Options

    • -A: or--time=atime or--time=access or--time=use only change the access time;
    • -C: Or--no-create does not create any files or if the file does not exist.
    • -d:< Time Date > Use the specified date time, not the current time;
    • -F: Attempts to force Touch to run, regardless of the file's read and write permissions;
    • -M: or--time=mtime or--time=modify only the change time;
    • -r:< reference file or directory > set the date and time of the specified file or directory to the same date and time as the reference file or directory;
    • -t:< Date Time > Use the specified datetime, not the current time;
    • --help: Online Help;
    • --version: Displays version information.

Parameters
File: Specifies the list of files for which you want to set time properties.

Note:
    • The touch command calls the Utime () subroutine to change the modification and access time of the files involved. When you do not actually own the file, even if you have write permission to the file, the use of the flag may cause the Touch command to fail.
    • When using the Touch command, if you receive an error message, do not specify the full pathname /usr/bin/touch.

Example 1 Touch file This sets the last access and modification time of the file to the current date and time. If the file does not exist, theTouch command creates an empty file with the same name.

Example 2 touch-c file avoid creating new files

Example 3 touch-c-t time file name explicitly set access and modification times

Example 4 touch-r file name 1 file name 2 to use the timestamp of another file without the current time

Self-study linux shell3.4-file processing command touch CP MV RM

Related Article

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.