BM Balmiki Mandal 04 May 2023 0 views 0 comments Linux

A Guide to the Touch Command in Linux

Introduction to Touch Command in Linux

The touch command is one of the most versatile commands used in the Linux operating system. It is used to create, modify and update the access and modification time of a file or directory. Touch command is part of the GNU Coreutils package that comes pre-installed in most Linux distributions. This guide will explain how to use the touch command in Linux.

How to Use Touch Command in Linux

Touch command accepts options along with file or directory names as arguments. Let's go through some examples of the most common uses of the touch command.

Create a file: To create a new empty file using the touch command, simply type “touch filename.extension”, replacing filename and extension with preferred name and type respectively. For example, to create an HTML file, type “touch myfile.html”.

Modify timestamp: Touch can be used to modify the timestamp of an existing file or directory. To do this, type “touch -t YYYYMMDDHHMM filename.extension”, replacing the values after -t with the Year (YYYY), Month (MM), Date (DD), Hours (HH) and Minutes (MM).

Update access and modification times: To update the access and modification times of a file or directory, type “touch -a filename.extension” or “touch -m filename.extension”. This will update the Access ( -a ) or Modification ( -m ) times of the file.

Conclusion

The touch command is a powerful and useful tool for managing files and directories in the Linux operating system. It can be used to create, modify, and update the access and modification times of a file or directory. This guide explained how to use the touch command in Linux and presented common use cases.

0 Comments

No comments yet, Be the first to comment.

Post a Comment

Please sign in to post a comment.

Related Posts

How to Create an Embedded Linux Development Environment on Windows Using WSL2

 Creating an Embedded Linux Development Environment on Windows Using WSL2If you are learning Embedded Linux, y...

AG Anvesh G 05 Sep 2026
Installing Ubuntu OS in Window Using VirtualBox

Installing Ubuntu on Windows Using VirtualBoxSteps:-1. Download and Install VirtualBox Download VirtualBox fr...

BM Balmiki Mandal 18 Jan 2025
Kali Linux 2021.4, Apple M1 support, armhf, arm64, Electro4u

Kali Linux 2021.4 Brings Improved Apple M1 Support Kali Linux, the world’s premier open-source penetration te...

BM Balmiki Mandal 06 Jun 2023