StevensNet.com

...Because someone's gotta tell the story...

Blogs

To return to the main Blog List, click Full Blog Listing.

Tags

Site Updates
Technical

Linux Tricks: Creating Files (Multiple) with a twist

Thursday, November 01, 2018 in Linux (Views: 274)
In an earlier blog, we talked about how to create files using touch.

Example: touch newfile creates a file called newfile.

[breakglass@learn a]$ touch newfile
[breakglass@learn a]$ ls -l
total 0
-rw-rw-r--. 1 breakglass breakglass 0 Dec 26 12:55 newfile


In this quick blog, how do we create multiple files?

Using touch and a wildcard, we can create multiple files at once.

[breakglass@learn a]$ touch newfile{1..5}
[breakglass@learn a]$ ls
newfile1 newfile2 newfile3 newfile4 newfile5


We can also use multiple wildcards:
[breakglass@learn a]$ touch {a..c}{1..3}
[breakglass@learn a]$ ls
a1 a2 a3 b1 b2 b3 c1 c2 c3


Fast and easy, how we create multiple files in Linux with a single command.

 

Related Blogs You May Be Interested In:


To leave a comment, please log in and/or register.