How to Create a File With a touch Command on CentOS

This post will guide you on how to create a file using “touch” command. The touch command is easy to use and there are two reason to use it.

1. To create a file.
2. To update a file’s modification date.

The touch command is part file utilities package and has several options.

How to create new files using touch ?

    [root@server ~]# touch newtestfile1
    [root@server ~]# ls -l
    total 0
    -rw-r--r-- 1 root root 0 Jan 11 10:43 newtestfile1
    

Descriptions :
As you can see, touch creates a file with a length, or size, of zero

Leave a Reply

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

SiteGround.com

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.

TRY FREE

* up to 30 days money back guarantee