touch

Change a file access and modification times (atime, mtime). More information: <https://www.gnu.org/software/coreutils/touch>.

Install

All systems
curl cmd.cat/touch.sh
Debian Debian
apt-get install coreutils
Ubuntu
apt-get install coreutils
Alpine
apk add coreutils
Arch Arch Linux
pacman -S coreutils
image/svg+xml Kali Linux
apt-get install coreutils
CentOS
yum install coreutils
Fedora
dnf install coreutils
Windows (WSL2)
sudo apt-get update sudo apt-get install coreutils
OS X
brew install coreutils
Raspbian
apt-get install coreutils
Docker
docker run cmd.cat/touch touch powered by Commando

Change a file access and modification times (atime, mtime). More information: <https://www.gnu.org/software/coreutils/touch>.

  • Create a new empty file(s) or change the times for existing file(s) to current time:
    touch path/to/file
  • Set the times on a file to a specific date and time:
    touch -t YYYYMMDDHHMM.SS path/to/file
  • Set the time on a file to one hour in the past:
    touch -d "-1 hour" path/to/file
  • Use the times from a file to set the times on a second file:
    touch -r path/to/file1 path/to/file2
  • Create multiple files:
    touch path/to/file{1,2,3}.txt

© tl;dr; authors and contributors