Linux程序员@IT·互联网

touch命令介绍

2016-11-13  本文已影响38人  SnailTyan

文章作者:Tyan
博客:noahsnail.com  |  CSDN  |  简书

1. 创建文件

touch命令可以用来创建新的文件,也可以用来修改文件的修改时间。touch命令创建了一个新文件,并将你的用户名作为文件的属主。

# 命令形式:touch filename

# 创建新文件
$ touch test
$ ls -l
total 0
-rw-r--r--  1 ***  staff  0 11 13 13:12 test

# 修改文件的修改时间
$ touch test
$ ls -l
total 0
-rw-r--r--  1 ***  staff  0 11 13 13:13 test

2. 修改文件的访问时间

-a参数用来修改文件的访问时间。

# 命令形式:touch -a filename

$ touch -a test

# 查看文件访问时间
$ ls -lu
total 0
-rw-r--r--  1 ***  staff  0 11 13 13:33 test

参考文献:

  1. Linux命令行与shell脚本编程大全(第三版)
上一篇 下一篇

猜你喜欢

热点阅读