As you all knows Touch command is used to create a quick file of any extension. Touch command can be used to modify the access/modification timestamps of files. You can even create a simple blank file with the help of Touch command.
For Example, if you want to create a totally blank file in your Kali Linux machine, then just type “touch file.txt” And in case, if that “file.txt” already exists, then it will update the access time automatically.
You can also create multiple files in same location by typing “touch file1.txt file2.txt file3.txt“. You just need to add a space in between the file names.
With the help of touch command, you can even create a lots of file like “touch {A..Z}“, “touch {1..20}” and “touch {1..1000}.txt“. Be careful when you are testing with above commands because it will create alot of files within a span of 1 second.
If you want to just update the access time of existing file, without creating it, you can “touch -c file.txt“.
And to change only access time, you can use “touch -a file.txt“.
The best thing about Linux machine is, you can easily check the access time of any file with the help of stat command as per below screenshot.
Furthermore, -m attribute is used to change the modified time of any file like “touch -m file.txt” and for multiple files, you can try “touch -m *.txt“.
You can change both access time and modified time together by typing “touch -am file.txt“.
To set the access/modify time to a specific date time, you can use -t option and specify the date time in format [[CC]YY]MMDDhhmm[.ss] like “touch -c -t 1603051015 file.txt“.
You can even use the timestamp of another file as a reference by typing “touch -r reference.txt file.txt“.
With -d option, you can also define the date time as a string by typing “touch -c -d ’15 Aug’ file.txt”
You may also like:- Most Common DNS Record Types and Their Roles
- Top Skills Needed to Become a Cybersecurity Analyst
- Mastering Windows Management with WMIC Commands – Top 20 Examples
- Edit and Compile Code with the Best 5 Code Editors
- 50+ Top DevSecOps Tools You Need To Know
- Learn How to Add Proxy and Multiple Accounts in MoreLogin
- Some Useful PowerShell Cmdlets
- Create Free SSL Certificate – ZEROSSL.COM [2020 Tutorial]
- Generate Self-Signed SSL Certificate with OPENSSL in Kali Linux
- RDP – CredSSP Encryption Oracle Remediation Solution 2020