Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

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|improve this answer
4  
Could also add alias t='touch' to your .bashrc :P –  Der Flatulator Sep 23 '13 at 9:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.