Creating test files


Some of my books and articles require you to create some files for testing. This can be done easily from the command line.

  • Open a terminal session on your desktop.
  • Copy the line below from this post.
  • Paste it into the terminal session.
  • Press the Enter key.

This Bash program creates 200 files with “Hello world filexxx” in each, where xxx is the file number. You can edit the program and change “200” to any number of files that you need.

for I in `seq -w 200` ; do echo "Hello world file$I" > testfile$I.txt ; done