访问手机版  

Linux常用命令|Linux培训学习|考试认证|工资待遇与招聘,认准超级网工!

招聘|合作 登陆|注册

网络工程师培训

当前位置:网络工程师 > 技术课程 > linux > 热点关注 > linux常用命令

Linux常用基本命令( touch )

时间:2019-06-15

常用linux命令大全_linux常用命令_常用dos命令大全

Linux常用基本命令( touch )

touch命令:

作用:创建空文件,或者改变文件的时间戳属性

格式: touch [option] [file]

linux常用命令_常用linux命令大全_常用dos命令大全

1,同时创建一个或者多个空文件

ghostwu@dev:~/linux/mkdir$ ls
ghostwu@dev:~/linux/mkdir$ touch a.txt
ghostwu@dev:~/linux/mkdir$ ls
a.txt
ghostwu@dev:~/linux/mkdir$ touch b.txt c.txt
ghostwu@dev:~/linux/mkdir$ ls
a.txt  b.txt  c.txt
ghostwu@dev:~/linux/mkdir$ touch {1..5}.txt
ghostwu@dev:~/linux/mkdir$ ls
1.txt  2.txt  3.txt  4.txt  5.txt  a.txt  b.txt  c.txt

2,创建文件,并用stat查看文件的属性状态信息

ghostwu@dev:~/linux/mkdir$ touch ghostwu.txt
ghostwu@dev:~/linux/mkdir$ stat ghostwu.txt 
  File: 'ghostwu.txt'
  Size: 0             Blocks: 0          IO Block: 4096   regular empty file
Device: 807h/2055d    Inode: 9569451     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/ ghostwu)   Gid: ( 1000/ ghostwu)
Access: 2018-05-01 17:25:16.439856937 +0800
Modify: 2018-05-01 17:25:16.439856937 +0800
Change: 2018-05-01 17:25:16.439856937 +0800
 Birth: -

常用linux命令大全_常用dos命令大全_linux常用命令

最后有3个时间

Access time:最后访问时间,查看文件的内容时,这个时间会改变linux常用命令,使用cat命令查看文件时,可以看出Access time已经变了

ghostwu@dev:~/linux/mkdir$ stat ghostwu.txt 
  File: 'ghostwu.txt'
  Size: 0             Blocks: 0          IO Block: 4096   regular empty file
Device: 807h/2055d    Inode: 9569451     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/ ghostwu)   Gid: ( 1000/ ghostwu)
Access: 2018-05-01 17:25:16.439856937 +0800
Modify: 2018-05-01 17:25:16.439856937 +0800
Change: 2018-05-01 17:25:16.439856937 +0800
 Birth: -
ghostwu@dev:~/linux/mkdir$ cat ghostwu.txt 
ghostwu@dev:~/linux/mkdir$ stat ghostwu.txt 
  File: 'ghostwu.txt'
  Size: 0             Blocks: 0          IO Block: 4096   regular empty file
Device: 807h/2055d    Inode: 9569451     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/ ghostwu)   Gid: ( 1000/ ghostwu)
Access: 2018-05-01 17:27:51.887215139 +0800
Modify: 2018-05-01 17:25:16.439856937 +0800
Change: 2018-05-01 17:25:16.439856937 +0800
 Birth: -