Linux touch command usage examples

Linux touch command usage examples

Detailed explanation of linux touch command:

1. Command function:

Creation and modification timestamps of files or directories

2. Command syntax:

touch [options] [file name or directory name]

3. Command parameters:

-a only changes the access time of the file.

-c or --no-create does not create non-existent files.

-d Use the specified date and time instead of the current time

-m means to modify the Modify time instead of the Access time

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

Note: access indicates the time when the file was last accessed (only accessed, no changes were made)

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 changes the time to the date specified by the parameter, such as: 07081556 means 15:56 on July 8

4. Usage examples:

Create a non-existent file, such as in the /data directory:

1.png

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

2.png

Modify the modify time of a file, such as modifying the modify time of the /data/westoslinux file

3.png

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

4.png

The above is the detailed content of the detailed explanation of the Linux touch command. For more information, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • Detailed explanation of 9 useful touch command examples in Linux
  • Detailed explanation and usage of Linux touch and chattr commands
  • A simple Linux command touch
  • One shell command a day Linux text operation series - touch command usage

<<:  The implementation process of ECharts multi-chart linkage function

>>:  MySQL partitioning practice through Navicat

Recommend

Let's talk about bitwise operations in React source code in detail

Table of contents Preface Several common bit oper...

MySQL 5.7 zip archive version installation tutorial

This article shares the installation tutorial of ...

Solution to the problem that the InnoDB engine is disabled when MySQL is started

Find the problem Today at work, when copying tabl...

How to create users and manage permissions in MySQL

1. How to create a user and password 1. Enter the...

What are the rules for context in JavaScript functions?

Table of contents 1. Rule 1: Object.Method() 1.1 ...

jQuery implements form validation

Use jQuery to implement form validation, for your...

JavaScript implements the detailed process of stack structure

Table of contents 1. Understanding the stack stru...

Solve the mobile terminal jump problem (CSS transition, target pseudo-class)

Preface Many friends who have just come into cont...

Windows Server 2019 IIS10.0+PHP(FastCGI)+MySQL Environment Construction Tutorial

Preparation 1. Environmental Description: Operati...

Ubuntu installs multiple versions of CUDA and switches at any time

I will not introduce what CUDA is, but will direc...

Detailed explanation of the spacing problem between img tags

IMG tag basic analysis In HTML5, the img tag has ...

The difference between shtml and html

Shtml and asp are similar. In files named shtml, s...

VMware ESXi 5.5 deployment and configuration diagram process

Table of contents 1. Installation requirements 2....