Linux常用基本命令( touch )
touch命令:
作用:創(chuàng)建空文件,或者改變文件的時間戳屬性
格式: touch [option] [file]
1,同時創(chuàng)建一個或者多個空文件
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,創(chuàng)建文件,并用stat查看文件的屬性狀態(tài)信息
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: -
最后有3個時間
Access time:最后訪問時間,查看文件的內(nèi)容時,這個時間會改變linux常用命令,使用cat命令查看文件時,可以看出Access time已經(jīng)變了
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: -