Skip to content
Technology News Information & Jobs

Technology News Information & Jobs

Ubuntu Tutorials, Ubuntu How To , Linux Tips, Tech Jobs

  • Work with US
  • Search Jobs
  • Post a Job
  • Contact Us
  • Ubuntu
    • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Themes
  • Linux
  • Laptops
  • Tutorials
  • Job Dashboard
  • Toggle search form
Examples of Touch Command in Linux

What Is A Touch Command: Examples of Touch Command in Linux

Posted on September 5, 2018September 5, 2018 By admin No Comments on What Is A Touch Command: Examples of Touch Command in Linux

Insight: Examples of touch command in Linux

What Is A Touch Command ?

In a simple definition, we can call touch command as a file processing command. The touch command is the easiest way to create new files. Touch command is used to modify the timestamps of files.

What Is A Touch Command: Examples of Touch Command in Linux

Touch command syntax is

touch [option] file_name(s)

When touch command is used without any options, it creates new files for any file names ( provided as arguments ).

touch itsubuntu.txt​

1. ​How to create a blank file or an empty file

touch <filename>

2. How to create multiple files

touch <file1> <file2> <file3>

 

3. How to avoid creating new files

Touch command create an empty file if the input file doesn’t exist otherwise it will update the timestamps of the input file.

Use the option “-c”.

touch -c itsubuntu.txt

4. How to change access time of a file

touch -a itsubuntu.txt​

5. How to ​use the timestamp of another file as reference

Set the access/modify time of fedora.txt to that of itsubuntu.txt

​touch -r itsubuntu.txt fedora.txt

6. How to change access time of a file

Use the command below to change the access time of a file using the”-a”option with the file name.

touch -a itsubuntu.txt​

Now, check it if it is changed or not?

stat itsubuntu.txt

 

READ More Relevant Stuff:  Meet Raspberry Pi Pico, Raspberry Silicon From Raspberry Foundation [Specs]

7. How to update only modify time of a file

touch -m itsubuntu.txt

Now check it.

stat itsubuntu.txt

8. Change timestamp of a symbolic link

You can use the -h option.

touch -h <symbolic_link>

 

9. Create a File using a specified time

Use the following command to create a file with specified time other than the current time

 touch -t YYMMDDHHMM.SS itsubuntu

10. Create a multiple files

# Create files with names 1 to 20

touch {1..20}

# Create files with names A to Z

 touch {A..Z}

# Create files with extension

 touch {1..1000}.txt

# Create 10K files

 touch {1..10}{1..1000}

List of options with Touch Command

  • ​-a – Access time of a file.
  • -c – Do not create a specified file if it does not exist.
  • -m – Change the modification time of file.
  • -r -use this file’s times instead of current time.
  • -t –  use [[CC]YY]MMDDhhmm[.ss] instead of current time.
  • -d, –date=STRINGparse STRING and use it instead of current time.

 

Let us know if there is error in the commands mentioned above.

Linux

Post navigation

Previous Post: Useful Multimedia Applications For Ubuntu 18.04 LTS
Next Post: Best Digital Audio Workstation Apps For Linux In 2018

Related Posts

Linux Mint 21.2 Beta Is Now Available For Download Linux Mint 21.2 Beta Is Now Available For Download Linux
Upgrade To Ubuntu 20.04 LTS : From Ubuntu 18.04 LTS, Ubuntu 19.10 Upgrade To Ubuntu 20.04 LTS : From Ubuntu 18.04 LTS,Ubuntu 19.10 Linux
Install Squid Proxy on Ubuntu 20.04 Install Squid Proxy on Ubuntu 20.04 Linux
How To Upgrade To Ubuntu 23.04 From Ubuntu 22.10 How To Upgrade To Ubuntu 23.04 From Ubuntu 22.10 Linux
VirtualBox Installation VirtualBox 6.0 Released With Tons Of Improvements Linux
Best YUM Command Examples For Everyone Best YUM Command Examples For Everyone Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Enable Hibernate in Ubuntu 22.04 LTS May 20, 2024
  • Popular Ubuntu Games: Top 5 Games To Play March 17, 2024
  • WordPress | Your site doesn’t include support for the “generateblocks/container” block GenerateBlocks Plugin February 11, 2024
  • Ubuntu Autoremove Command Debian Autoremove Command February 10, 2024
  • How To Mount Windows 11 Shares on Debian Linux December 7, 2023
  • Anonymous Browsing 101: A Deep Dive Into Residential Proxies November 20, 2023
  • How To Correctly Install Uninstall Linux Ubuntu Nvidia Drivers Fast October 31, 2023
  • Ethical Web Design: The Dos and Don’ts October 28, 2023
  • Understanding the Role of Security Operations Center October 25, 2023
  • The Positive Effects of AI Tools and Online Services on Students Successful Essay-Writing Skills October 3, 2023
  • Linux Wget Examples September 27, 2023

Categories

  • Android
  • Apple
  • Blogs
  • Debian
  • Fix
  • Gadgets
  • Game
  • Google
  • How To Ubuntu
  • Internet
  • Laptops
  • Linux
  • Linux Commands
  • Linux Game
  • Linux Mint
  • News
  • Operating Systems
  • Security
  • Technology
  • Themes
  • Tools
  • Tutorials
  • Ubuntu
  • ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Windows 11
  • Wordpress
  • Search Jobs
  • Post a Job
  • Job Dashboard
  • Contact Us
  • About US
  • Cookie Policy
  • Terms and Conditions
  • Privacy Policy
  • Sitemap
  • Write For US

Tags

android apps centos ChatGPT command Commands Debian deepin Desktop docker Fedora fix game games Gaming gnome google kernel linux linux commands linux kernel Linux laptops Linux Mint Linux themes minecraft NVIDIA Python Raspberry Pi sysadmin themes ubuntu ubuntu 18.04 Ubuntu 18.04 LTS Ubuntu 20.04 ubuntu 20.04 lts Ubuntu 22.04 LTS Ubuntu games Ubuntu kernel ubuntu themes ubuntu tutorial VirtualBox Windows Windows 11 Wine WSL
itsubuntu.com is an Equal Opportunity Employer. For Advertisement, Jobs, Guest posts, and any other thoughts, email us at [email protected]
  • Prepared Foods Order Writer (Deli / Culinary – Buyer / Inventory Replenishment) – Full Time

    • Thayne, WY
    • Whole Foods Market
    • Full Time
  • Sr. Risk and Controls Compliance Policy Writer (on-site Phoenix, Chicago, San Fran)

    • San Francisco, CA
    • INSPYR Solutions
    • Full Time
  • Artificial Intelligence & Gen AI Engineer – Tampa, Hybrid

    • Tampa, FL
    • Citigroup Inc
    • Full Time
  • Sr. Technical Documentation Specialist – REMOTE

    • Atlanta, GA
    • HHS Technology Group, Inc.
    • Full Time
  • TECHNOLOGY VICE PRESIDENT, ARTIFICIAL INTELLIGENCE & MACHINE LEARNING AND DATA

    • Falls Church, VA
    • NLP PEOPLE
    • Full Time
  • Architectural Drafter

    • Sarasota, FL
    • Start To Finish Drafting
    • Full Time
  • Senior or Principal Data Scientist – Technical AI Ethicist

    • Seattle, WA (Remote)
    • salesforce.com, inc.
    • Full Time
  • Artificial Intelligence (AI) Data Scientist

    • Fairfax, VA
    • General Dynamics Information Technology
    • Full Time

Copyright © 2025 Technology News Information & Jobs.

Powered by PressBook Grid Blogs theme