How to modify the file time of the Linux system

  

The time of creating the Linux system file is not unchangeable. The touch command can modify the time of the file to achieve the effect of false. Here's a look at how the Linux system can modify the file.

described with respect to the touch command:

-d, --date = STRING

parse STRING and use it instead of current time

Touch parameter description:

Command parameters:

-a or --time=atime or --time=access or --time=use Only change the access time.

-c or --no-create does not create any documents.

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

-f This parameter will be ignored and will only be used to resolve compatibility issues with the BSD version of the touch directive.

-m or --time=mtime or --time=modify only changes the change time.

-r Sets the date and time of the specified document or directory to the same date and time as the reference document or directory.

-t Use the specified date and time instead of the current time.

--no-create will not create a new file.

--help Lists the instruction format.

--version Lists version messages.

Here you can use a simple modification of the file time.

Example: Modify some files in the system to three months ago:

The current system file information is as follows:

[root@case test]# ls - l

total 28

drwxr-xr-x 2 root root 4096 Jan 9 15:47 1333

-rwxrwxr-x 1 oracle oinstall 8143 Jan 9 14:41 3 .sh

drwxr-xr-x 2 root root 4096 Jan 9 15:49 444

-rw-r--r-- 1 root root 0 Jan 9 14:41 4.sh

-rwxr-xr-x 1 root root 8143 Jan 9 14:44 77.sh

-rwxrwxr-x 1 root root 54 Jan 9 16:03 find.sh

Change all .sh files to the time three months ago (October 13, 2015). Operation command:

[root@case test]# touch -d “10/13/2013” *.sh

The result is:

[root@case test ]# ls -l

total 28

drwxr-xr-x 2 root root 4096 Jan 9 15:47 1333

-rwxrwxr-x 1 oracle oinstall 8143 Oct 13 00:00 3.sh

drwxr-xr-x 2 root root 4096 Jan 9 15:49 444

-rw-r--r-- 1 root root 0 Oct 13 00: 00 4.sh

-rwxr-xr-x 1 root root 8143 Oct 13 00:00 77.sh

-rwxrwxr-x 1 root root 54 Oct 13 00:00 find.sh

Alternatively, you can modify the time or month separately, as follows

to use am, pm or 24 hour format, the date can use other formats such as 6 May 2000.

touch -d “6:03pm” file

touch -d “05/06/2000” file

touch -d “6:03pm 05/06/2000” file

The above is the way the Linux system can modify the file time, so that the user can view it or the file recognition time can be changed to a few months ago. .

Copyright © Windows knowledge All Rights Reserved