Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 11 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
5  
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.