Delete and Move Files

LinuxLinuxBeginner
Practice Now

Introduction

In this challenge, you will learn how to delete, copy, and move files in Linux systems using common command-line utilities.

Achievements

By completing this challenge, you will gain practical experience with the following commands:

  • rm - remove files or directories
  • cp - copy files or directories
  • mv - move files or directories

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/FileandDirectoryManagementGroup(["`File and Directory Management`"]) linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux/FileandDirectoryManagementGroup -.-> linux/cd("`Directory Changing`") linux/BasicFileOperationsGroup -.-> linux/cp("`File Copying`") linux/BasicFileOperationsGroup -.-> linux/mv("`File Moving/Renaming`") linux/BasicFileOperationsGroup -.-> linux/rm("`File Removing`") subgraph Lab Skills linux/cd -.-> lab-7777{{"`Delete and Move Files`"}} linux/cp -.-> lab-7777{{"`Delete and Move Files`"}} linux/mv -.-> lab-7777{{"`Delete and Move Files`"}} linux/rm -.-> lab-7777{{"`Delete and Move Files`"}} end

Delete Files

In this step, we'll use the rm command to remove files from a Linux system.

A folder named challenge1 has been created in /home/labex/project. It contains a file named challenge1.txt. Your task is to delete this file using the rm command.

TODO

Delete the file challenge1.txt from /home/labex/project/challenge1/challenge1.txt.

Requirements

  • Work in the Linux terminal, starting from the /home/labex/project/challenge1 directory.
  • Use the rm command to remove the challenge1.txt file.

Copy Files

In this step, we'll use the cp command to copy files in a Linux system.

A folder named challenge2 has been created in /home/labex/project. It contains a file named challenge2.txt. Your task is to copy this file to the challenge1 directory using the cp command.

TODO

Copy the file /home/labex/project/challenge2/challenge2.txt to the /home/labex/project/challenge1 directory.

Requirements

  • Work in the Linux terminal, starting from the /home/labex/project/challenge2 directory.
  • Use the cp command to copy the challenge2.txt file.

Move Files

In this step, we'll use the mv command to move files in a Linux system.

A folder named challenge3 has been created in /home/labex/project. It contains a file named challenge3.txt. Your task is to move this file to the challenge1 directory using the mv command.

TODO

Move the file /home/labex/project/challenge3/challenge3.txt to the /home/labex/project/challenge1 directory.

Requirements

  • Work in the Linux terminal, starting from the /home/labex/project/challenge3 directory.
  • Use the mv command to move the challenge3.txt file.

Summary

Congratulations! You have successfully completed the file operations challenge. In this exercise, you've practiced three essential file manipulation commands: rm, cp, and mv. These commands are frequently used in Linux systems, so it's crucial to be familiar with them.

You've learned how to:

  1. Delete files using rm
  2. Copy files using cp
  3. Move files using mv

These skills form the foundation of file management in Linux environments. Keep practicing and exploring more advanced uses of these commands to become proficient in Linux file operations.

Other Linux Tutorials you may like