Creating multiple files and directories that have common terms or patterns can be done quickly from the Linux command line. For this, the braces {} are useful.
Multiple directories with common terms:
Example: To create directories named DailyReport2020, WeeklyReport2020, QuarterlyReport2020, MonthlyReport2020 and YearlyReport2020, there is no need to use mkdir command separately for each of them.
Instead, put the common term (“Report” or “ly” and “Report” both in this example) outside the braces and include the other non-common terms inside the braces.
So, a single line command can make these multiple directories in one go :
Or
Multiple files with common terms:
Similarly, to create files with common patterns (e.g: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday), the one line command will be :
This will quickly create these files using braces.
Listing files and directories:
Also, if you’d like to distinguish between files and directories when listing them from the Linux command line, the -F parameter with ls is helpful instead of the plain ls command.
Directories will have a slash next to them while the files won’t.
This can be a timesaver when trying to view the contents of a folder or directory that has a lot of items in it. You can also set it is an alias for ls. Here is how to do that.
All done.