您的位置:首页 > 运维架构 > Linux

Linux下touch命令的用法

2016-01-12 23:20 489 查看
Touch Command Options

a, change the access time only

-c, if the file does not exist, do not create it

-d, update the access and modification times

-m, change the modification time only

-r, use the access and modification times of file

-t, creates a file using a specified time

1.创建一个新的空文件

# touch sheena


2.创建多个文件

# touch sheena meena leena


3.只修改access time为现在的时间,-a

# touch -a leena


4.只修改modification time为现在的时间,-m

# touch -m leena


5.如果文件不存在,避免创建新文件,-c

# touch -c leena


6.同时精确设定access and modification times,-t

# touch -c -t YYDDHHMM leena


sets the access and modification date and time to a file leena as 17:30 (17:30 p.m.) December 10 of the current year (2012).

# touch -c -t 12101730 leena


7.使用另一个指定文档的access and modifications times设定文件的时间戳,-r

# touch -r leena meena


8.创建一个新文件并指定精确的access and modifications times

# touch -t YYMMDDHHMM.SS tecmint


# touch -t 201212101830.55 tecmint
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: