if you touch a source file in a source software package you force recompiling it and all dependencies. This is sometimes needed, for example if you want see again some compiler warnings... or see if your Makefile is rebuilding correctly the dependencies. Another use is to set modification time of a file to a different value (usually a date in the past). Answer from stef_eda on reddit.com
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to use touch command in linux
How to Use touch Command in Linux (12 Examples)
December 19, 2025 - Use the touch command to set a specific timestamp for an existing file, for example: ... The digits in the square brackets are optional. When using the two-digit year format, setting YY to any number between 0-68 automatically assumes CC is 20, whereas 69-99 assumes CC is 19. For example, to change the timestamp for a file called test to midnight January 1st, 1999, run: ... Use the --full-time option with ls to see timestamp details.
Videos
03:57
Linux touch command summary with examples - YouTube
07:16
How to use the Linux Touch command - YouTube
08:22
How to use touch command in Linux - YouTube
08:06
Linux Command Line Basics Tutorials - touch Command in Linux - YouTube
05:02
Linux Tutorials | touch command | GeeksforGeeks - YouTube
02:28
How to use the touch command: 2-Minute Linux Tips - YouTube
Hostinger
hostinger.com › home › tutorials › linux touch command: what it is + examples of how to use it to modify timestamps
What Is Linux Touch Command + Practical Usage Examples
August 21, 2025 - When you use a symbolically linked file name with the Linux touch command, the timestamp information for the original file, that was pointed by the link file, gets modified. To change the access and modification time to the current time for a symbolically linked file, use the h option: ... The Linux touch command can also set a file’s access and modification time by reading the timestamp information from another file. For example, the following touch command with the r option will scan the timestamp information from reference.txt and set these timestamp values to file_name.txt.
GeeksforGeeks
geeksforgeeks.org › linux-unix › touch-command-in-linux-with-examples
Creating an Empty File in Linux | Touch Command - GeeksforGeeks
The touch command creates a new, empty file if the file does not already exist. If the file already exists, it updates the file’s last modified timestamp instead of overwriting it.
Published December 8, 2025
Javatpoint
javatpoint.com › linux-touch
Touch Command in Linux/Unix with Examples - javatpoint
Touch Command in Linux/Unix with Examples for beginners and professionals with examples on files, directories, permission, backup, ls, man, pwd, cd, chmod, man, shell, pipes, filters, regex, vi etc..
Reddit
reddit.com › r/linux › touch command - what situations require its use?
r/linux on Reddit: Touch Command - What Situations Require Its Use?
October 24, 2021 -
Before someone tells me to read the man or info pages, I do know what it does. That is not my question.
I'm asking in what specific situations do people use the touch command? A timestamp is usually something that does not need to be changed very often.
Top answer 1 of 17
37
i mainly use it for making empty files for projects
2 of 17
35
if you touch a source file in a source software package you force recompiling it and all dependencies. This is sometimes needed, for example if you want see again some compiler warnings... or see if your Makefile is rebuilding correctly the dependencies. Another use is to set modification time of a file to a different value (usually a date in the past).
LinuxBlog
linuxblog.io › home › touch command in linux /w examples
touch command in Linux /w examples
November 11, 2024 - The touch command in Linux is a versatile tool for creating empty files or updating timestamps on existing ones. Despite its simplicity, it plays a crucial role in file management. In this article, we’ll delve into the basics of using the touch command in Linux, complete with practical examples ...
LinuxConfig
linuxconfig.org › home › touch command in linux with examples
touch command in Linux with examples
August 23, 2021 - If you’d only like to change the access time of a file, rather than the modification time, use the -a option in your touch command. ... Conversely, the -m option can be used with the touch command to only update a file’s modification time. ... NOTE You can always use the man command to read more about the touch command and its official documentation. Click the previous link to see how to open the manual pages for any command on a Linux system.
Linux Hint
linuxhint.com › touch-command-linux
Touch Command in Ubuntu 22.04 – Linux Hint
Tutorial on the “touch” Linux command to create the empty files or change the file timestamps (last date or time of file access or modification) in Ubuntu.
Linux Handbook
linuxhandbook.com › touch-command
Touch Command in Linux: 9 Useful Examples
March 11, 2025 - You can use the touch command with -c option in such cases: ... Touch will create a new empty file if it doesn’t exist, else it will modify the timestamps of the existing file. You can stop the creation of a new file with the -c option. If you use touch on an existing file, it will change access, modify and change time of that file. For example, I have this file named sherlock.txt with the following timestamps:
Wikipedia
en.wikipedia.org › wiki › Touch_(command)
touch (command) - Wikipedia
1 month ago - By default (no options specified), touching a file is equivalent to creating it with no content or if it exists, opening and saving it without any content changes to update the modification timestamp to be current. This convenience functionality is useful for a variety of scenarios including build and backup. The tools used in such scenarios typically ignore files that are older than a certain point of time. For example, make ignores a source code file that is older than the object file it is used to create.
Mepis
mepis.org › linux
How do I use the touch command in Linux? - Linux - Mepis Forum
September 10, 2024 - I’ve been trying to create new empty files using the ‘touch’ command on my Linux system, but I’m not sure if I’m doing it right. Can someone explain how to properly use ‘touch’ and maybe point out common mistakes or pitfalls? I need to understand this to maintain my project files ...
Educative
educative.io › answers › what-is-the-touch-command-in-linux
What is the touch command in Linux?
The -m argument is used to alter only the modification time. Note that filename(s) is mandatory for all types of arguments. In the example below, we create two files using the touch command...