Find out how to Use the ‘contact’ Command in Linux

by | Aug 18, 2023 | Etcetera | 0 comments

The touch Linux command is useful for patrons who need to create, regulate, or substitute document timestamps. Essentially, the command signifies that you’ll be able to “touch” a document, rising it if it doesn’t exist, or updating the get admission to and modification circumstances if it does. It’s a simple however difficult command that plays a very powerful place in document regulate.

While the touch command is unique in its capacity, it often works in conjunction with directions like ls for record data and chmod for changing permissions. Execs similar to instrument administrators, developers, and data analysts find this command handy for various tasks like scripting, document team, and automation.

Learn the way to Use touch

1. Creating a New Empty File

Syntax: touch filename

Rationalization: Creates a brand spanking new empty document named “filename.”

Example: touch newfile.txt

The command creates a brand spanking new empty document named newfile.txt.

2. Updating the Timestamp of an Provide File

Syntax: touch existingfile

Rationalization: Updates the get admission to and modification timestamps of existingfile to the current time.

See also  3 Best WordPress AI Page Builders in 2023 (Compared)

Example: touch myfile.txt

The command updates the timestamps of myfile.txt.

3. Rising A couple of Empty Information

Syntax: touch file1 file2 file3

Rationalization: Creates a couple of new empty data.

Example: touch file1.txt file2.txt file3.txt

The command creates 3 new empty data named file1.txt, file2.txt, and file3.txt.

4. The use of a Particular Timestamp

Syntax: touch -t TIMESTAMP filename

Rationalization: Devices the get admission to and modification timestamps of filename to a decided on time.

Example: touch -t 202201011200 myfile.txt

The command gadgets the timestamps of myfile.txt to 12:00 on January 1, 2022

5. Creating a File with a Particular Date

Syntax: touch -d DATE_STRING filename

Rationalization: Devices the get admission to and modification timestamps of filename to a decided on date and time.

Example: touch -d '1 Jan 2022 12:00' myfile.txt

The command gadgets the timestamps of myfile.txt to 12:00 on January 1, 2022.

6. Creating a File without Changing Timestamps if It Exists

Syntax: touch -c filename

Rationalization: Creates filename if it does not exist, then again does not alternate timestamps if it does.

Example: touch -c existingfile.txt

If existingfile.txt does not exist, the command creates it. If it does exist, the command does no longer the rest.

7. Creating a File with a Reference File’s Timestamps

Syntax: touch -r REF_FILE filename

Rationalization: Devices the get admission to and modification timestamps of “filename” to test those of a reference document “REF_FILE.”

Example: touch -r reference.txt myfile.txt

The command gadgets the timestamps of myfile.txt” to test those of reference.txt.

8. Creating a File and Suppressing Error Messages

Syntax: touch -f filename

Rationalization: Creates filename and suppresses most error messages.

See also  80 Asana Keyboard Shortcuts for Home windows and Mac

Example: touch -f myfile.txt

The command creates myfile.txt and suppresses most error messages.

Additional Linux directions:
List Operations rmdir · cd · pwd
File Operations cat · cp · dd · much less · ls · mkdir · mv · tail · tar · zip
File Gadget Operations chown · mkfs
Networking ping · curl · wget · iptables
Search and Text Processing in finding · grep · sed · whatis
Gadget Information and Keep an eye on env · historical past · most sensible · who
Client and Session Keep an eye on display screen · su · sudo

The put up Find out how to Use the ‘contact’ Command in Linux seemed first on Hongkiat.

WordPress Website Development

Supply: https://www.hongkiat.com/blog/linux-command-touch/

[ continue ]

WordPress Maintenance Plans | WordPress Hosting

Contents

See also  Office Loneliness Isn’t Getting Higher [New Data]

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!