Three obfuscated primary modification times for linux Files
Source: Internet
Author: User
Linux Files have three modification times, which many of my friends like to confuse and include me. These files are now listed for reference. 1) modificationtime (mtime, modification time): This time refers to the time when the file content is modified, not the modification of the file attribute. When the data content is modified, this time changes, by default, the ls-l command displays three modifications to the Linux file, which many friends like to confuse and include me. It is now listed for reference.
1) modifiCatIonTime(Mtime, modification time ):This time refers
File Content ModificationWhen the data content is modified, this time will change.
CommandLs-L this time is displayed by default:
2)StatUs time (ctime, status time ):When a file
StatusThis time will change when the file is changed, for example, the permission and attribute of the file are changed.
3) access time (atime, access time ):When
Read File ContentThe time will be changed. For example, if you use cat to read/etc/man. config, The atime of the file will change. Example: # ls-l -- full-time/etc/man. config mtime
-Rw-r -- 1 root 4522 18:47:54. 000000000 + 0800/etc/man. config # ls-l -- time = atime -- full-time/etc/man. config
-Rw-r -- 1 root 4522 2010-03-15 14:20:20. 000000000 + 0800/etc/man. config # ls-l -- time = ctime -- full-time/etc/man. config
-Rw-r -- 1 root 4522 16:21:55. 000000000 + 0800/etc/man. config example # cat/etc/man. check atime again after config execution. The time has been changed # ls-l -- time = atime -- full-time/etc/man. config
-Rw-r -- 1 root 4522 2010-03-15 14:24:30. 000000000 + 0800/etc/man. config :#
ChmodO-r/etc/man. config to view the ctime, which has been changed.
# Ls-l -- time = ctime -- full-time/etc/man. config
-Rw-r ----- 1 root 4522 2010-03-15 14:28:34. 000000000 + 0800/etc/man. config if you edit the file content, the mtime will change. If you want to view the three time conditions of the file together, you can run the command stat to view # stat/etc/man. config
File: '/etc/man. config'
Size: 4522 Blocks: 24 IO Block: 4096 regular
File Device: 807 h/2055d Inode: 1049307 Links: 1
Access: (0640/-rw-r -----) U
Id: (0/root) Gid: (0/root)
Access: 14:24:30. 000000000 + 0800
Modify: 18:47:54. 000000000 + 0800
Change: 14:28:34. 000000000 + 0800 time is exactly the same as the above time. The file time is very important, because if you misjudge the file time, it may cause some programs to fail to run normally. In case we find that the time of a file is the future time (this problem often occurs, the GMT time we mentioned during installation is that). How can we change the time to the current time? We only need one
TouchCommand. Touch is used to: touch [-actmd] file parameter:-a: only modify access time-c: only modify the time without creating a file-t: Followed by a time, format: [YYMMDDhhmm]-m: only modify mtime-d: followed by date or --
Date= "Date or time" for example. if the config date is adjusted to two days ago, then: # touch-d "2 days ago"/etc/man. the configuration result atime and mtime will change, but the ctime will not change. By using the touch command, you can easily modify the date and time of a file and create an empty file. However, note that, even if you copy a file and copy all the property pages, you cannot copy the ctime property. Commonly used touch commands are: 1) Create an empty file 2) change the date of a file to the current date (mtime and atime)
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.