Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to create a file from shell input. That is, I want to run some command, then type the desired contents of my file, then press Ctrl-D and have it create my file with the contents I typed in.

What would be the command for that?

share|improve this question
    
Is this homework? –  Zypher Oct 12 '11 at 0:27
    
No! I'm stuck for an hour at work because of this! But I'm happy to know it's easy enough to be considered homework! –  Ram Rachum Oct 12 '11 at 0:28
add comment

1 Answer

up vote 3 down vote accepted

You use the cat command to concatenate STDIN to the file like so: cat >> out.txt (or to blow away the already existing file, don't append cat > out.txt) then type when done press ctl+d to terminate when you are done.

share|improve this answer
add comment

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.