LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2016, 08:33 AM   #1
PencilBob
LQ Newbie
 
Registered: Oct 2016
Posts: 4

Rep: Reputation: Disabled
How to copy console input to file


Is there a way in Linux to create a file from standard input?
In Dos, one would do

copy con: sample.txt
some text
<ctrl-z>

What is the Linux equivalent?
 
Old 10-05-2016, 08:49 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Code:
[schneidz@hyper lqiso]$ echo 'hello
> world
> l33t h4x0rz
> chun-li
> akuma' > sample.txt
 
1 members found this post helpful.
Old 10-05-2016, 09:08 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Another way is via cat

cat >sample.txt
some text goes here.
<ctrl-c>
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Write a shell script that receives a word, an input file and an output file. The scripts copies all the lines in the input file that contain mandy2112 Linux - Newbie 3 08-18-2016 10:11 AM
[SOLVED] Error Splicing File: Input/Output Error - Cannot Copy imayneed Linux - Software 19 02-28-2016 10:44 AM
removing punctuations from file input or standard input (UNIX) lwj94 Programming 3 03-24-2014 09:07 AM
i want to a copy a file from root to a floppy on the console using slackware 10.0 salviadud Linux - Newbie 2 02-07-2005 10:32 PM
Why the file /dev/console is so difficult to copy? Xiangbuilder Linux - General 1 09-06-2003 09:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration