How to create files with different names?

060

To create files with different names in Bash, you can use the touch command along with specific file names. Here are a few methods:

1. Creating Files Individually

You can create files one by one:

touch file1.txt file2.txt file3.txt

2. Using Brace Expansion

You can create files with a pattern:

touch file_{A,B,C}.txt

This will create file_A.txt, file_B.txt, and file_C.txt.

3. Using a Loop

You can use a loop to create files with a sequence:

for i in {1..5}; do
    touch "file_$i.txt"
done

This will create file_1.txt, file_2.txt, file_3.txt, file_4.txt, and file_5.txt.

4. Specifying Different Names

You can also specify different names directly:

touch report.txt summary.txt notes.txt

Choose the method that best fits your needs! If you have more questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!