Skip to content

Linux touch Guide

Mattscreative edited this page Nov 20, 2025 · 2 revisions

📝 Linux touch Guide

Complete beginner-friendly guide to touch on Linux, covering Arch Linux, CachyOS, and other distributions including creating files, updating timestamps, and file management.


📋 Table of Contents

  1. Understanding touch
  2. touch Basics
  3. Creating Files
  4. Updating Timestamps
  5. Troubleshooting

🎯 Understanding touch

What is touch?

touch creates empty files or updates timestamps.

Uses:

  • Create files: Make empty files
  • Update timestamps: Change file times
  • File management: Manage file times
  • Scripts: Create files in scripts

Why it matters:

  • File creation: Quick file creation
  • Timestamp management: Update file times
  • Scripting: Useful in automation

📝 touch Basics

Create File

Basic usage:

# Create empty file
touch file.txt

# Create multiple files
touch file1.txt file2.txt file3.txt

Update Timestamp

Update time:

# Update timestamp
touch existing-file.txt

# Updates access and modification time

📄 Creating Files

With Path

Create in location:

# Create with path
touch /path/to/file.txt

# Creates file at path

Multiple Files

Create several:

# Create multiple
touch file{1..10}.txt

# Creates file1.txt through file10.txt

⏰ Updating Timestamps

Set Specific Time

Custom timestamp:

# Set specific time
touch -t 202401151200 file.txt

# Format: YYYYMMDDHHMM

Reference File

Match another file:

# Match reference file
touch -r reference.txt file.txt

# Copies timestamp from reference

🔧 Troubleshooting

Permission Denied

Fix permissions:

# Check directory permissions
ls -ld /path/to/directory

# Use sudo if needed
sudo touch /path/to/file.txt

📝 Summary

This guide covered touch usage, file creation, and timestamp management for Arch Linux, CachyOS, and other distributions.


🔗 Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally