Wednesday 8 July 2015

How to write to a file from terminal

How to write to a file from terminal
type this command
  echo "linux is cool">>linux.txt
if you don't want to append(write without erasing previous content) then you can use this(NOTE the single arrow)
 echo "linux is cool">linux.txt


if you run echo "linux is cool">>linux.txt  this two times then contents of linux.txt would be "1st line is linux is cool and 2nd line is linux is cool"
But if you run echo "linux is cool">linux.txt  this two times then contents of linux.txt would be "linux is cool"
                            

No comments:

Post a Comment