![]() ![]() Use the -d ( -date=) option to specify a date string and use it instead of the current time. The touch command also allows us to update or create a file with a specific time other than the current time. When changing the modify time, the change time will be also updated. Use the -m option to change the file’s modify time: touch -m file1 Auto insert timestamp while entering data 1. Use the -a option to change only the file’s access time: touch -a file1 Change only the modify time # ![]() By using the -a and -m options, you can change only one of these timestamps. If you don’t want the touch command to create new files, use the -c ( -no-create) option.įor example, if the file file1 exist the following command will change the file timestamps otherwise, it will do nothing: touch -c file1 Changing only access or modification times #īy default, if no option is used touch will update the file last access and modification times to the current time. To create or modify multiple files at once, specify the file names as arguments: touch file1 file2 file3 If the file already exists touch will change the file last access and modification times to the current time.įor example, if the file file1 doesn’t exist the following command will create it otherwise, it will change its timestamps: touch file1 In it’s simplest form when used without any options, if the file name specified as an argument doesn’t exist touch will create a new file. Otherwise, you will receive a permission denied error. To display the file status including the timestamps, use the statĬreating a new file requires write permissions on the parent directory. The attribute includes file permissions, file ownership or file location. ![]()
0 Comments
Leave a Reply. |