Home
Cloud
Big Data
CI
Install
Samples
Java
Ubuntu
Maven
Archive
Linux-Ubuntu
|
touch -- change file access and modification times
Notes
Examples
Command Help (man touch)
Notes
By default, the
touch
command changes the modification and access times of the file.
If the file does not exist, it will be created (empty file) with default permissions (the username and groupname of the user will be used as the file owner).
Examples
Create the file if it doesn't exist.
$ touch file1 $ ls -l file1 7 Jan 07:32 file1
Do not create the file if it doesn't exist.
$ touch -c file2 #file2 doesn't exist im my system, so because of the option "-c" it won't be created. $ ls file2 ls: file2: No such file or directory
Command Help (man touch)
The following options can be used:
-c |Do not create the file if it does not exist. -a |Change the access time of the file. |The modification time of the file is not changed unless the -m flag is also specified. -m |Change the modification time of the file. |The access time of the file is not changed unless the -a flag is also specified. -h |If the file is a symbolic link, change the times of the link itself rather than the file that the link points to. |Note that -h implies -c and thus will not create any new files.
© 2010-2022
mti
tek