Reputation: 248
For testing purposes I have to create a file with 1000 lines in it with one command.
What is a command to create a file on Linux?
Upvotes: 1
Views: 173
Reputation: 503
you use the above for loop use print something $c times in text.txt.$c is number of runnning time (1,2,4...10000)
for (( c=1; c<=1000; c++ ));do echo "something $c times">>test.txt ;done
Upvotes: 0
Reputation: 987
touch
is usually used to create empty files, but if you want to create a non-empty file, just redirect the output of some command to that file, like in the first line of this example:
$ echo hello world > greeting.txt
$ cat greeting.txt
hello world
A way to create a file with 1000 lines would be:
$ seq 1000 > file
Upvotes: 2