Linux/Unix – Making an Empty File

 You may sometimes want to create a new, empty file as a kind of “placeholder.” To do so, give the name that you want to use for the file as an argument to touch.

 To create the file `a_fresh_start’ in the current directory, type:

$ touch a_fresh_start

 

To create the file `another_empty_file’ in the `work/completed’ subdirectory of the current directory, type:

 $ touch work/completed/another_empty_file

This tool “touches” the files you give as arguments. If a file does not exist, it creates it; if the file already exists, it changes the modification timestamp on the file to the current date and time, just as if you had used the file.

 NOTE: Often, you make a file when you edit it, such as when in a text or image or sound editor; in that case, you don’t need to make the file first.

Advertisements

About msotela

This blog is for anyone who wants to access the power of a Linux system as a systems administrator or user. You may be a Linux enthusiast, a Linux professional, or possibly a computer professional who is increasingly finding the Windows systems in your data center supplanted by Linux boxes.

Posted on March 16, 2009, in Unix/Linux. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: