Skip to main content

Task 2: Navigate, Manage & Clean Up Files

Action Plan: "Start by breaking down your seemingly impossible goal into smaller, actionable tasks. Create a detailed plan outlining the steps required to achieve your goal. Identify any potential obstacles or challenges and brainstorm solutions to overcome them."

Affirmations: "I am committed to making the impossible possible and finishing my work. I am capable of overcoming any challenges that come my way. With persistence and determination, I will achieve success."


πŸ”Ή If you don’t understand the task, watch the video above for the answer.
πŸ”Ή Practice Tip: Try repeating this task with different file names and directories to master what you've learned!


Understanding the Task​

Our task is divided into four parts:
1️⃣ Navigating the workspace (Finding the current directory and listing files)
2️⃣ Preparing the workspace (Creating directories and files)
3️⃣ Managing files (Copying, moving, and organizing files)
4️⃣ Cleaning up unnecessary files (Removing files and directories)

Now, let’s go step by step!


Task 1: Navigate to Your Workspace

Step 1: Find Your Current Directory​

pwd

Step 2: List All Files (Including Hidden Files)

ls -la

This lists all files and folders, including hidden ones (which start with a .).

πŸ“Œ Task 2: Prepare the Workspace Step 1: Create a Directory Called projects

mkdir project

This creates a folder named projects.

Step 2: Move into the projects Directory

cd projects

Now we are inside the projects folder.

Step 3: Create a File Named notes.txt

touch notes.txt

This creates an empty text file named notes.txt. Run ls to confirm it's there.

Step 4: Create a Folder Named backup

mkdir backup

Now we have a backup folder inside projects.

Task 3: Manage Files Step 1: Copy notes.txt into backup/

cp notes.txt backup/

This copies notes.txt into the backup folder while keeping the original in place.

Step 2: Move notes.txt into a New Directory Named archive/

mkdir archive 

mv notes.txt archive/ Now notes.txt has been moved into archive/.

Step 3: Confirm File Location

ls archive/
ls backup/

You should see notes.txt inside archive/, but NOT in backup/.

πŸ“Œ Task 4: Cleanup Unnecessary Files Step 1: Remove notes.txt from archive/

rm archive/notes.txt

This permanently deletes notes.txt from archive/.

Step 2: Delete the Entire backup/ Directory

rm -r backup/

Since backup/ is a folder, we need the -r (recursive) flag to delete it along with its contents.

Step 3: Verify That backup/ Has Been Removed

ls

If backup/ is not in the list anymore, it was successfully deleted!