The touch command in Linux system is to update the directory or file to execute the time and date commands, but there are still many users who are not clear about the touch command. Therefore, Xiaobian introduces you today. Let's use the touch command.
touch command tips:
Name: touch
Access: All users
use:
Touch [-acfm]
[-r reference-file] [--file=reference-file]
[-t MMDDhhmm[[CC]YY][.ss]]
[-d time] [--date=time] [--time={atime,access,use,mtime,modify}]
[--no-create] [--help ] [--version]
file1 [file2 ...]
Description:
The touch command changes the time record of the file. Ls -l can display the time record of the file.
Parameters:
a Change the read time record of the file.
m Change the modification time record of the file.
c If the destination file does not exist, a new file will not be created. Same effect as --no-create.
f Not used, it is reserved for compatibility with other unix systems.
r Use the time record of the reference file, the same as --file.
d Set the time and date, and you can use a variety of different formats.
t Set the time record of the file in the same format as the date command.
--no-create will not create a new file.
--help Lists the instruction format.
--version Lists version messages.
Example of use:
Example 1: Creating a file that does not exist
Command:
touch log2012.log log2013.log
Output:
[root@localhost test]# touch log2012.log log2013.log
[root@localhost test]# ll
-rw-r--r- - 1 root root 0 10-28 16:01 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
If log2014 .log does not exist, no file is created
[root@localhost test]# touch -c log2014.log
[root@localhost test]# ll
-rw -r--r-- 1 root root 0 10-28 16:01 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
Instance 2: Update log.log with the same log2012.log timestamp
Command:
touch -r log.log log2012.log
:
[root@localhost test]# ll
-rw-r--r-- 1 root root 0 10-28 16:01 log2012.log
- Rw-r--r-- 1 root root 0 10-28 16:01 log20 13.log
-rw-r--r-- 1 root root 0 10-28 14:48 log.log
[root@localhost test]# touch -r log.log Log2012.log
[root@localhost test]# ll
-rw-r--r-- 1 root root 0 10-28 14:48 log2012.log
-rw-r--r-- 1 root root 0 10-28 16:01 log2013.log
-rw-r--r-- 1 root root 0 10-28 14:48 log. Log Previous12Next page Total 2 pages
In the Linux system, if you browse the webpage when you download something, it will
In Ubuntu 12.04 system, there is sometimes a shortage of space in the /boot space,
Many users have used Docker to reflect the time when the Docker container is out of sync with the ho
In the KDE desktop environment of Ubuntu system, many users will encounter flashbac
How does Linux use tools to encrypt data?
Beginners how to view the shell guide in Linux
Krita software in the Linux system tutorial
Xfs Extension Method Guide for Linux
How to modify the time zone of CentOS6 system?
What is the command to specify the line in the Linux view file?
How to use sed command in Linux
Linux set swap swap partition steps
How to solve the garbled problem when opening Emacs under Linux?
How to configure the IP and host name of the CentOS7 system
How to solve the problem that the VPN client connection to the Linux server is slow to slow down
Also my hard disk space, XP system weight loss method (1)
How does Win7 look at the computer configuration? View computer configuration methods
What if Win7 prohibits storing files on the desktop?
Win10 tutorial: The "Start" menu is back and it's better than before.
Win7 system network connection service prompts 1068 error solution
How to encrypt Windows 8 system disk partitions
Zooming in on the Win7 taskbar preview. You can see the