How to delete multiple files?

QuestionsQuestions8 SkillsProBasic Files OperationsSep, 23 2025
0128

To delete multiple files in a Unix-like operating system, you can use the rm command followed by the names of the files you want to delete. Here are a couple of methods:

Method 1: Specify Each File

You can list each file you want to delete:

rm file1.txt file2.txt file3.txt

Method 2: Use Wildcards

If the files share a common pattern, you can use wildcards. For example, to delete all .txt files in the current directory:

rm *.txt

Method 3: Interactive Mode

If you want to confirm each deletion, use the -i option:

rm -i file1.txt file2.txt file3.txt

Caution:

Be careful when using rm, especially with wildcards, as deleted files cannot be easily recovered.

If you have more questions or need further assistance, let me know!

0 Comments

no data
Be the first to share your comment!