touch命令

Linux touch命令用于修改文件或者目录的时间属性,包括存取时间和更改时间。若文件不存在,系统会建立一个新的文件。
注意到touch命令是在youtube上的一个video,对一个存在的文件,使用touch命令将更新文件或者目录的时间属性。

[root@centos-linux-10 workspace]# ll -al
总用量 80
drwxr-xr-x. 3 root root  4096 12月 31 15:05 .
dr-xr-x---. 7 root root  4096 12月 31 15:05 ..
drwxr-xr-x. 2 root root  4096 1月   3 23:35 cprimer
-rwxr-xr-x. 1 root root  9904 12月 11 16:59 getopt
-rw-r--r--. 1 root root   413 12月 11 16:59 getopt.c
-rwxr-xr-x. 1 root root 10416 12月 11 17:10 getopt_long
-rw-r--r--. 1 root root   777 12月 11 17:09 getopt_long.c
-rwxr-xr-x. 1 root root 10104 12月 11 18:17 man
-rw-r--r--. 1 root root   955 12月 11 18:17 man.c
-rw-r--r--. 1 root root  1491 12月 11 11:18 socket.c
-rwxr-xr-x. 1 root root 11088 12月 11 11:10 webbench
-rw-r--r--. 1 root root   278 12月 11 10:16 webbench.c
[root@centos-linux-10 workspace]# 
[root@centos-linux-10 workspace]# 
[root@centos-linux-10 workspace]# touch socket.c 
[root@centos-linux-10 workspace]# touch cprimer/
[root@centos-linux-10 workspace]# ll -al
总用量 80
drwxr-xr-x. 3 root root  4096 12月 31 15:05 .
dr-xr-x---. 7 root root  4096 12月 31 15:05 ..
drwxr-xr-x. 2 root root  4096 1月   4 00:11 cprimer
-rwxr-xr-x. 1 root root  9904 12月 11 16:59 getopt
-rw-r--r--. 1 root root   413 12月 11 16:59 getopt.c
-rwxr-xr-x. 1 root root 10416 12月 11 17:10 getopt_long
-rw-r--r--. 1 root root   777 12月 11 17:09 getopt_long.c
-rwxr-xr-x. 1 root root 10104 12月 11 18:17 man
-rw-r--r--. 1 root root   955 12月 11 18:17 man.c
-rw-r--r--. 1 root root  1491 1月   4 00:11 socket.c
-rwxr-xr-x. 1 root root 11088 12月 11 11:10 webbench
-rw-r--r--. 1 root root   278 12月 11 10:16 webbench.c
[root@centos-linux-10 workspace]# 

我们可以看到在使用touch命令后,socket.c文件和目录cprimer的时间已修改为当前系统时间。

Linux磁盘分区UUID的获取及其UUID的作用

[root@centos-7 workspace]# blkid /dev/sda1
/dev/sda1: UUID="1c3b15b1-cd13-4a73-b2a8-449fa3aa039f" TYPE="xfs"