Skip to content

Linux touch Command Builder (Create Files & Update Timestamps)

The touch command is used to create empty files or update timestamps in Linux. This interactive touch Command Builder helps you generate precise touch commands.


🚀 What is the touch Command?

The touch command allows you to:

  • Create empty files instantly
  • Update access and modification times
  • Change specific timestamps
  • Avoid overwriting existing files
  • Reference timestamps from other files

⚙️ Basic Syntax

touch [options] FILE
touch [options] FILE1 FILE2 ...

🧠 How to Use This touch Command Builder

This tool helps you:

  • Create new files or update existing ones
  • Set specific timestamps
  • Use timestamps from reference files
  • Generate a ready-to-use touch command

Workflow

  1. Specify file path(s)
  2. Choose timestamp options (current time, reference file, specific date)
  3. Choose which timestamps to update (access, modification, both)
  4. Copy generated command

🔧 Common touch Usage Patterns

Create Empty File

touch newfile.txt

Create Multiple Files

touch file1.txt file2.txt file3.txt

Create File Without Overwriting

touch -c file.txt

Update Modification Time Only

touch -m file.txt

Update Access Time Only

touch -a file.txt

Set Specific Date/Time

touch -d "2024-01-15 14:30:00" file.txt

Copy Timestamp from Another File

touch -r reference.txt file.txt

Use Specific Time Format

touch -t 202401151430.00 file.txt

🔧 Time Format Reference

  • -d uses date format: "YYYY-MM-DD HH:MM"
  • -t uses format: "[[CC]YY]MMDDhhmm[.ss]"
    • CC = century (20)
    • YY = year (24)
    • MM = month (01-12)
    • DD = day (01-31)
    • hh = hour (00-23)
    • mm = minute (00-59)
    • ss = second (00-59)

✅ Pro Tips

  • Use -c to avoid creating files (just update timestamps)
  • Reference-based timestamps are perfect for build systems
  • Perfect for creating placeholder files in scripts
  • Can make files appear older or newer for testing

Related Tools

Explore other developer tools that pair well with Linux command builders:

Related Tools

Try these complementary developer tools:

Popular Developer Tools

Most-used tools on LangStop