From the GNU touch documentation:
touch changes the access and/or modification timestamps of the specified files.
So, if the file exists, then touch
modifies it's timestamps. We can check this:
$ stat .
File: '.'
Size: 40 Blocks: 0 IO Block: 4096 directory
Device: 11h/17d Inode: 2338759 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 1000/ chronos) Gid: ( 1000/ chronos)
Context: u:object_r:tmpfs:s0
Access: 2018-10-29 08:06:16.918056344 +0530
Modify: 2018-10-29 08:06:15.484056316 +0530
Change: 2018-10-29 08:06:15.484056316 +0530
Birth: -
Now we run touch .
and then:
$ stat .
File: '.'
Size: 40 Blocks: 0 IO Block: 4096 directory
Device: 11h/17d Inode: 2338759 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 1000/ chronos) Gid: ( 1000/ chronos)
Context: u:object_r:tmpfs:s0
Access: 2018-10-29 08:06:29.131056579 +0530
Modify: 2018-10-29 08:06:29.131056579 +0530
Change: 2018-10-29 08:06:29.131056579 +0530
Birth: -
Note how the Access:
, Modify:
and Change:
fields have changed.