Type strait into a file from the terminal.

cat /dev/tty > FILE
Takes input from the connected terminal and dumps it to the specified file. Stop writing and close file with control + D or the end of line character. Useful for copying+pasting large blobs of text over SSH to a new machine.
Sample Output
$ cat /dev/tty > myFile.txt
blahblahblah what? <Return>
This is in a file! <Ctrl+D>

$ ls -a
. .. myFile.txt

$ cat myFile.txt
blahblahblah what?
This is in a file!

By: Jo
2009-02-25 01:43:47

What Others Think

Simply "cat > FILE" works too.
vic · 636 weeks and 2 days ago
But my favorite is 'script ' it's recording everything you type interactively. And I can't remember the screen command that does the same.
pruneau · 636 weeks and 2 days ago
cat - > FILE or cat - >> FILE #lets you resume
laprice · 636 weeks and 2 days ago
vic and laprice beat me to it.
ozymandias · 636 weeks and 2 days ago
pruneau: ^A-H to start/stop logging your session.
unixmonkey1811 · 636 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: