Here is a neat trick we found recently that allows us to create multiple files with 1 single line of code in Linux.
This is probably not the best way to create hundreds of new files but certainly a quick method without using loops.
Here are the steps:
Launch the Terminal and navigate to the directory where the files will be created:

Run the following command to create 10 text files immediately:
“touch file{1..10}.txt
┌──(test㉿kali)-[~]
└─$ touch file{1..10}.txt
Run “ls -l” to see the output:
┌──(test㉿kali)-[~/Desktop]
└─$ touch file{1..10}.txt
┌──(test㉿kali)-[~/Desktop]
└─$ ls -l
total 0
-rw-r--r-- 1 test test 0 Feb 21 10:54 file10.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file1.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file2.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file3.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file4.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file5.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file6.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file7.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file8.txt
-rw-r--r-- 1 test test 0 Feb 21 10:54 file9.txt
┌──(test㉿kali)-[~/Desktop]
└─$
We may want to delete all these file and there is a simple way to do that as well.
Run “rm *.*” while inside the folder that contains the files you would like to delete to delete all of the files in the folder.
run “ls -l” to validate.
┌──(test㉿kali)-[~/Desktop]
└─$ rm *.*
┌──(test㉿kali)-[~/Desktop]
└─$ ls -l
total 0
┌──(test㉿kali)-[~/Desktop]
└─$

Leave A Comment