0
0
Linux CLIscripting~10 mins

rm (remove files) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Remove Files Using rm Command
📖 Scenario: You are organizing your computer files. Some files are no longer needed and take up space. You want to safely remove these files using the rm command in the Linux terminal.
🎯 Goal: Learn how to use the rm command to delete files step-by-step. You will create files, set up a list of files to remove, use the rm command to delete them, and then check the result.
📋 What You'll Learn
Create files using the touch command
Use a variable to list files to remove
Use the rm command with the variable
Check the remaining files with ls
💡 Why This Matters
🌍 Real World
Removing unwanted files helps keep your computer organized and frees up space.
💼 Career
System administrators and developers often need to clean up files safely using commands like <code>rm</code>.
Progress0 / 4 steps
1
Create Files to Remove
Create three empty files named file1.txt, file2.txt, and file3.txt using the touch command.
Linux CLI
Need a hint?

Use touch followed by all three file names separated by spaces.

2
List Files to Remove
Create a variable called files_to_remove and assign it the value "file1.txt file2.txt" (the files you want to delete).
Linux CLI
Need a hint?

Use files_to_remove="file1.txt file2.txt" to store the file names as a string.

3
Remove the Files
Use the rm command with the variable files_to_remove to delete the files listed in it.
Linux CLI
Need a hint?

Use rm $files_to_remove to remove the files stored in the variable.

4
Check Remaining Files
Use the ls command to list the remaining files in the directory and confirm only file3.txt remains.
Linux CLI
Need a hint?

Just type ls to see the files left after removal.