touch命令有兩個功能:html
一是用於把已存在文件的時間標籤更新爲系統當前的時間(默認方式),它們的數據將原封不動地保留下來;shell
二是用來建立新的空文件。ui
-a change only the access time -c, --no-create do not create any files -d, --date=STRING parse STRING and use it instead of current time -f (ignored) -h, --no-dereference affect each symbolic link instead of any referenced file (useful only on systems that can change the timestamps of a symlink) -m change only the modification time -r, --reference=FILE use this file's times instead of current time -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time --time=WORD change the specified time: WORD is access, atime, or use: equivalent to -a WORD is modify or mtime: equivalent to -m --help display this help and exit --version output version information and exit
touch:建立file1—file10共10個文件this
touch file{1..10}
設定文件的時間戳spa
touch -t 201810121230 hh.sh 【-t用十進制數】3d
更新log.log的時間和log2012.log時間戳相同orm
touch -r hh hh.sh 【touch -r目標文件 源文件】