In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Touch
Modify the access time and modification time of the file to the current time. If the specified file does not exist, an empty file will be created unless the-c or-h option is specified. The file parameter string'-'is specially processed and causes touch to change the time of the file associated with standard output.
The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
Touch [options] file
2. List of options
Option
Description
-- help
Show help documentation
-- version
Display version information
-a
Only change the visit time
-c |-- no-create
Do not create a file
-d |-- date=time
Set to the specified time instead of the current time
-f
ignore
-h
Change only symbolic links
-m
Only change the modification time
-r |-- reference=file
The time to use the specified file
-t
Use CCYYMMDDhhmmss time
-- time=WORD
Change the specified time: Word to access, atime or use
"--date=STRING" is one of the main free-form human-readable date strings, such as "Sun, February 29th 16:21:42-0800" or "2004-02-29 16pur21VOL21", or even "next Thursday". The date string may contain items that indicate calendar date, daily time, time zone, midweek day, relative time, relative date, and number. An empty string represents the beginning of the day.
3. Examples
1) create a file
[root@localhost weijie] # ls / / File does not exist
1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c Tsplitaa Tsplitab Tsplitac Tsplitad xaa xab xac
[root@localhost weijie] # touch-c 6.c / / use option-c, do not create files
[root@localhost weijie] # ls
1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c Tsplitaa Tsplitab Tsplitac Tsplitad xaa xab xac
[root@localhost weijie] # touch 6.c / / create a file without using any options
[root@localhost weijie] # ls
1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c 6.c Tsplitaa Tsplitab Tsplitac Tsplitad xaa xab xac
2) modify the target file time with the specified file
[root@localhost weijie] # ll 1.c 2.c / / time to view files
-rwxr--r-- 1 root david 50 September 14 10:07 1.c
-rwxr--r-- 1 root root 13 September 16:52 2.c
[root@localhost weijie] # touch-r 2.c 1.c / / modify the time of 1.c to 2.c
[root@localhost weijie] # ll 1.c 2.c / / time to view files
-rwxr--r-- 1 root david 50 September 13 16:52 1.c
-rwxr--r-- 1 root root 13 September 16:52 2.c
A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.
Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.