The fastest way to create a file from a terminal

67,625

This will save you five keypresses relative to touch filename

>filename

but is not the equivalent of touch as it will truncate filename if it exists. The following does what you want

>>filename

but note that it is not equivalent to touch either, as it does not update filename's modification timestamp.

Share:
67,625

Related videos on Youtube

Radu Rădeanu
Author by

Radu Rădeanu

I was asked once, “You’re a smart man. Why aren’t you rich?” I replied, “You’re a rich man. Why aren’t you smart?” Jacques Fresco

Updated on September 18, 2022

Comments

  • Radu Rădeanu
    Radu Rădeanu over 1 year

    What is the simplest way to create a file using a command-line? Usually I use:

    touch filename

    But is this the simplest/fastest way?

  • azz
    azz over 10 years
    Could also add alias t='touch' to your .bashrc :P