One-liner to create a large number of test files at once on Linux

I had to prepare thousands of files at a time to check the operation, so make a note.

I haven't done anything strange. It also worked on Windows Bash (Ubuntu).

touch test.file;for i in {1..5000};do cp test.file test_${i}.file;done

↓ ↓ ↓ This is the same.

touch test_{1..5000}.file

This will create 5,000 (5,001 to be exact) files. You can create any number of files by changing the 5000 part.

If you want to specify the file size, it looks like this.

dd if=/dev/zero of=test.file bs=1M count=1;for i in {1..5000};do cp test.file test_${i}.file;done

This will create 5,000 1MByte files. The file size is bs x count, so you can specify any file size by changing this.

Recommended Posts

One-liner to create a large number of test files at once on Linux
Convert a large number of PDF files to text files using pdfminer
How to create a large amount of test data in MySQL? ??
How to find large files on Linux
How to create large files at high speed
Upload a large number of images to Wordpress
Organize a large number of files into folders
Try to create a new command on linux
I want to backtest a large number of exchange pairs and strategies at once with Python's backtesting.py
A tool to follow posters with a large number of likes on instagram [25 minutes to 1 second]
Paste a large number of image files into PowerPoint [python-pptx]
[Linux] Grep multiple gzip files in a directory at once
Create a Linux environment on Windows 10
Find large files / directories on Linux
I tried to create an environment of MkDocs on Amazon Linux
[Laravel] Aliase to create migration file of multiple tables at once
TensorFlow To learn from a large number of images ... ~ (almost) solution ~
[Django] What to do if the model you want to create has a large number of fields
Use shutil to delete all folders with a small number of files
ETL processing for a large number of GTFS Realtime files (Python edition)
Connect a large number of videos together!
How to put a line number at the beginning of a CSV file
Create a Linux virtual machine on Windows
How to test on a Django-authenticated page
Verification of how to periodically execute a script on a Linux server on Windows
TensorFlow To learn from a large number of images ... (Unsolved problem) → 12/18 Solved
How to put a lot of pipelines together and put them away at once
How to access the contents of a Linux disk on a Mac (but read-only)
[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn
Get a lot of Twitter tweets at once
How to create a shortcut command for LINUX
Consolidate a large number of CSV files in folders with python (data without header)
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
Use API to mark a large number of unread emails in Gmail as read
Create a dataset of images to use for learning
Accelerate a large number of simple queries with MySQL
Beginners try to convert Word files to PDF at once
Create a QR code for the URL on Linux
How to install Linux on a 32bit UEFI PC
Make your cursor a photo of your choice on Linux
To extract the data of a specific column in a specific sheet in multiple Excel files at once and put the data in each column in one row
Try to estimate the number of likes on Twitter
How to create a local repository for Linux OS
How to build a Python environment on amazon linux 2
Create a shape on the trajectory of an object
[Python] Randomly generate a large number of English names
I made a tool to get the answer links of OpenAI Gym all at once
How to set up WSL2 on Windows 10 and create a study environment for Linux commands
Unzip a lot of ZIP-compressed files with Linux commands to UTF8 and stick them together
Lambda + Python is good at restricting access with a large number of IP address lists
[Python] I wrote a test of "Streamlit" that makes it easy to create visualization applications.
How to display a specified line of a file or command result on Linux (sed, awk)
When generating a large number of graphs with matplotlib, I do not want to display the graph on the screen (jupyter environment)
I tried to make a script that traces the tweets of a specific user on Twitter and saves the posted image at once
A memo on how to easily prepare a Linux exercise environment
Search for large files on Linux from the command line
How to shuffle a part of a Python list (at random.shuffle)
[Command] Command to get a list of files containing double-byte characters
Run a limited number of image presentation programs on PsychoPy
Create a VS Code + Docker development environment on a Linux VM
[Introduction to AWS] A memorandum of building a web server on AWS