
You can check whether the timestamps were changed by issuing the stat command with the filename as an argument. You can change the modification time (mtime) of a file using the -m flag with touch as well. If the file does not exist, touch will create a new file and assign the timestamps to it. The above command will replace the access and change time of the file with the current time.
How to make a new file in termianl update#
To update the atime and ctime of a file, use the -a flag with the default touch command. You can change the access and change time of any file on your system using the touch command. touch fileone filetwo filethree Change File TimestampsĪs mentioned above, there are three timestamps associated with every file on your storage. Similarly, you can create multiple files altogether by passing the filenames separated by the space character. You can verify that the file has been created using the ls command. The aforementioned command will create a new file named newemptyfile in the current working directory. To create an empty file using touch, type touch followed by the filename.


You can utilize the functionalities of the touch command by passing various arguments and flags in place of options, whereas filename is the name of the file that you want to create.

The basic syntax of the touch command is: touch This is beneficial for software developers who have to constantly create new files, either for writing code or for validating the existence of a specific file. Unlike the cat command, which prompts you to add content to your file at the time of creation, the touch command creates an empty file without such prompts. The most basic use of the touch command is to create new empty files.
