Linux files have 3 modification times. Many of my friends like to get confused, including me, and are now listed for reference.
1)modification time (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 will change, with the command ls -l defaults to this time:
2)status time (ctime, status time): When the status of a file changes, this time will change, such as changing the permissions and attributes of the file, etc. It will change.
3) access time (atime, access time): When reading the contents of the file, it will change this time, for example, use cat to read /etc/man.config, then the atime of the file will change.
Example:
# ls -l --full-time /etc/man.config mtime
-rw-r--r-- 1 root root 4522 2007 -11-17 18:47:54.000000000 +0800 /etc/man.config
# ls -l --time=atime --full-time /etc/man.config
- Rw-r--r-- 1 root root 4522 2010-03-15 14:20:20.000000000 +0800 /etc/man.config
# ls -l --time=ctime --full-time /etc/man.config
-rw-r--r-- 1 root root 4522 2008-07-11 16:21:55.000000000 +0800 /etc/man.config
- -------------------------------------------------- --------------------------------
#cat /etc/man.config After executing, check again Atime, the time has been changed
# ls -l --time=atime --full-time /etc/man.config
-rw-r--r-- 1 root root 4522 2010-03-15 14:24:30.000000000 +0800 /etc/man.config
Change file permissions: # chmod or /etc/man.config
View ctime, has been changed.
# ls -l --time=ctime --full-time /etc/man.config
-rw-r----- 1 root root 4522 2010-03-15 14:28:34.000000000 +0800 /etc/man.config
If you edit the contents of the file, mtime will change.
If you want to view the three time conditions of the file together, you can use the command stat to view
# stat /etc/man.config
File: `/etc/man .config'
Size: 4522 Blocks: 24 IO Block: 4096 regular file
Device: 807h/2055d Inode: 1049307 Links: 1
Access: (0640/- Rw-r-----) Uid: ( 0/root) Gid: ( 0/root)
Access: 2010-03-15 14:24:30.000000000 +0800
Modify : 2007-11-17 18:47:54.000000000 +0800
Change: 2010-03-15 14:28:34.000000000 +0800
The time is exactly the same as the above time.
The time of the file is very important, because if the file time is misjudged, some programs may not work properly. In case we find a file time is in the future time (many times there will be this problem, we The GMT time mentioned in the installation is that meaning), then how can we make the time become the current time? We only need a touch command.
The usage of touch is:
touch [-actmd] File
Parameter:
-a: Modify only access time
-c: Modify the time only without creating a file
-t: You can pick up the time later. The format is: [YYMMDDhhmm]
-m: Modify only mtime
-d : You can pick up the date later, you can also use --date="date or time"
For example: adjust the date of man.config to two days ago, then:
#touch -d "2 days ago" /etc/man.config
The result atime and mtime will change and ctime will not change.
With the touch command, you can easily change the date and time of the file, and you can also create an empty file, but note that there is no way to copy the ctime attribute even if you copy a file and copy all the property pages.
The commonly used case of the touch command is
1) Creating an empty file
2) Changing the date of a file to the current date (mtime and atime)
Arista networks is a company that provides cloud computing network equipment for data centers. Its c
Microsoft announced the extension of the Windows Vista and Windows 7 lifecycle. The life cycle of W
With the advantage of strong stability, embedded DVR is increasingly accepted by the security indust
Before downloading the files on the Linux machine via FTP, upload it after the Windows editing, so
Introduction to the ISO boot method of the hard disk under Linux system
Under Linux, the CPU usage of C language is
How to set static IP address in CentOS 6.2
Linux query memory real utilization
The virtual machine Debian NIC cannot be started
Memcacheq service installation and principle overview
Solve the problem of starting Tomcat under Linux. Neither the JAVA
CentOS Linux builds .NET environment
Under the win10 system, Xiaona only displays text without sound solution
Windows XP Enhanced DOS Command
I want to buy a computer to watch the pioneer, where to buy better? Recommend
Turn off Windows system update reminder
Using XP SP2 imitation 2003 remote multi-user login
Win8 Phone Activation Detailed Guide
"Start browser when you are prompted to insert the GemGPK smart card" to resolve
Detailed analysis of Inf file application strategy
Win10 opens the Microsoft Xiaona "Find My Phone" feature graphic tutorial
How does the Win7 system recover deleted files from the recycle bin?