文档详情

(Linux新建文件命令.doc

发布:2017-01-22约9.78千字共11页下载文档
文本预览下载声明
Linux新建文件命令 touch命令。 touch命令用来修改文件的访问时间、修改时间。如果没有指定时间,则将文件时间属性改为当前时间。当指定文件不存在,则touch命令变为创建该文件。 语法: touch [-acm] [-d STRING-time] [-r reference-file] [-t [[CC]YY]MMDDhhmm[.ss]] 选项介绍: ????-a: 只修改访问时间; ????-c: 如果指定文件不存在,则不创建文件; ????-d STRING-time: 用字符串格式的时间来指定时间属性的修改值; ????-m: 只修改指定文件的修改时间; ????-r refernce-file: 将指定文件的时间属性改为与reference-file时间属性相同的值; ????-t [[CC]YY]MMDDhhmm[.ss]: 用[[CC]YY]MMDDhhmm[.ss]这种时间格式来指定时间属性的修改值; 执行范例: File: `text Size: 0 Blocks: 8 IO Block: 4096 regular empty file Device: 831h/2097d Inode: 211271681 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 514/ xxxx) Gid: ( 100/ users) Access: 2010-03-01 22:03:30.000000000 +0800 Modify: 2010-03-01 22:03:30.000000000 +0800 Change: 2010-03-01 22:03:30.000000000 +0800 $ cat text # 读文件 $ stat text # 发现文件的访问时间(Access)改变 File: `text Size: 0 Blocks: 8 IO Block: 4096 regular empty file Device: 831h/2097d Inode: 211271681 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 514/ xxxx) Gid: ( 100/ users) Access: 2010-03-01 22:04:08.000000000 +0800 Modify: 2010-03-01 22:03:30.000000000 +0800 Change: 2010-03-01 22:03:30.000000000 +0800 $ echo hello world text # 相当于写文件 $ stat text # 发现文件的修改时间(Modify)改变 File: `text Size: 12 Blocks: 16 IO Block: 4096 regular file Device: 831h/2097d Inode: 211271681 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 514/ xxxx) Gid: ( 100/ users) Access: 2010-03-01 22:04:08.000000000 +0800 Modify: 2010-03-01 22:04:58.000000000 +0800 Change: 2010-03-01 22:04:58.000000000 +0800 $ touch text #将文件的访问时间、修改时间改为当前时间 $ stat text File: `text Size: 12 Blocks: 16 IO Block: 4096 regular file Device: 831h/2097d Inode: 211271681 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 514/ xxxx) Gid: ( 100/ users) Access: 2010-03-01 22:05:41.000000000 +0800 Modify: 2010-03-01 22:05:41.000000000 +0800 Change: 2010-03-01 22:05:41.000000000 +0800 $ touch -a text # 只修改文件的访问时间 $ stat text File: `text Size:
显示全部
相似文档