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.
🌐
TecMint
tecmint.com › home › linux commands › 8 practical examples of linux “touch” command
8 Practical Examples of Linux "Touch" Command
July 13, 2023 - For example, the following command will create 3 files named, sheena, meena, and leena. ... To change or update the last access and modification times of a file called leena, use the -a option as follows.
🌐
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.
🌐
Server Academy
serveracademy.com › blog › how-to-use-the-touch-command-in-linux
How to Use the Touch Command in Linux - Server Academy
To change only the access time (atime) or modification time (mtime) of a file, use the `-a` or `-m` options respectively: touch -a example.txt # Updates only the access time touch -m example.txt # Updates only the modification time
🌐
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
🌐
LinuxTechi
linuxtechi.com › home › commands › 9 useful touch command examples in linux
9 Useful Touch Command Examples in Linux
April 14, 2024 - [root@linuxtechi ~]# touch -m /mnt/nfsshare/ [root@linuxtechi ~]# Use “-am” option in touch command to change the access and modification together or in one go, example is shown below,
🌐
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..
Find elsewhere
🌐
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.
🌐
Sanfoundry
sanfoundry.com › touch-command-usage-examples-linux
touch Command in Linux with Examples
November 18, 2023 - For example the following command will create 3 files named, abc,def,ghi. ... 3. To change or update the last access and modification times of a file called abc, use the -a option as follows.
🌐
Shapeshed
shapeshed.com › unix-touch
Linux and Unix touch command tutorial with examples | George Ornbo
September 19, 2024 - Tutorial on using touch, a UNIX and Linux command for changing file timestamps. Examples of creating an empty file, updating access and modification time, updating just access time, updating just modification time and setting timestamps in the past.
🌐
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.
🌐
Gcore
gcore.com › home › developers › how to use the touch command in ubuntu
How to Use the Touch Command in Ubuntu | Step-by-step Guide
April 8, 2025 - Whether you need to generate a ... through the step-by-step process of using the ‘touch’ command in Ubuntu, complete with examples and practical tips. Using the touch command in Linux offers several advantages and use cases:...
🌐
iO Flood
ioflood.com › blog › touch-linux-command
Using the Touch Command in Linux | Reference Guide
December 19, 2023 - Here’s how you can do it: touch newfile.txt ls -l newfile.txt # Output: # -rw-r--r-- 1 user group 0 Jan 1 00:00 newfile.txt · In this example, we used the touch command to create a new file named ‘newfile.txt’. We then used the ls -l ...
🌐
PrepBytes
prepbytes.com › home › linux › touch command in linux with examples
Touch Command in Linux with Examples
December 1, 2023 - Here are some Basic Usage Examples of Touch Command in Linux: 1. Creating a New File: ... This command creates a new file named new_file.txt in the current directory if it doesn’t already exist.
🌐
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...