What’s the UNIX/Linux Equivalent of the old DOS ‘copy con’?

Yes, I’ve dated myself by referencing “copy con” to create a file… most folks working with computers probably have no idea– but I used to use this all the time to create a quick batch file, and it still works in Windows.

So how do you create a file within Linux? Well, there’s a multitude of ways, actually.  One of the easiest is ‘cat > filename.txt’, if you’re looking type directly from the console to the file called ‘filename.txt’. To end? No, not <ctrl>+<z> as in DOS (this will simply put the process in the background)– you’ll need to hit enter to get to a new line and then <ctrl>+<d> to send the “EOF” or “end of file” signal. This will save the file.

So why might you need this? In case you know exactly what you want to do that’s a little lengthy, but want to avoid the extra steps of opening and editor. But then again, why not just ‘vi’ it? 🙂


Leave a Reply