touch命令有兩個功能:
一是用于把已存在文件的時間標簽更新為系統(tǒng)當前的時間(默認方式),它們的數(shù)據(jù)將原封不動地保留下來;
二是用來創(chuàng)建新的空文件。
-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:創(chuàng)建file1—file10共10個文件
touch file{1..10}
設定文件的時間戳
touch%20-t%20201810121230%20hh.sh%20【-t用十進制數(shù)】
更新log.log的時間和log2012.log時間戳相同
touch -r hh hh.sh 【touch -r目標文件 源文件】
上一個教程:vi/vim常用命令介紹
下一個教程:【Linux常用命令小手冊】