Showing posts with label create set of files. Show all posts
Showing posts with label create set of files. Show all posts

Saturday, August 20, 2016

Creating multiple files in unix/linux

If you want to create a set of files like filename1, filename2,.., you can use touch command like below

$ touch filename{1,2,3}

$ ls -ltr
$ filename1 filename2 filename3

You could also use ranges to create multiple files

$ touch filename{1..5}

$ ls -ltr
$ filename1 filename2 filename3 filename4 filename5

You could also use any string of characters like below

$ touch {a..c}{1..5}

$ ls
a1  a2  a3  a4  a5  b1  b2  b3  b4  b5  c1  c2  c3  c4  c5

And you can use below command to remove set of files

$ rm -f {a..c}{1..5}