Organizing Files and Directories

LinuxBeginner
Practice Now

Introduction

Welcome to the Linux File Operations Challenge! In this exercise, you'll apply your skills to organize a small project by creating directories with mkdir and then using cp, mv, and rm to arrange the files. Imagine you're a system administrator organizing files for a small software project. Your task is to build the target structure and clean up the unused content efficiently in a Linux environment.

File and Directory Management

Tasks

  1. Organize a given set of files and directories into a structured project layout.
  2. Use cp, mv, and rm commands to achieve the desired structure.

Requirements

  • Start in the ~/project directory.
  • Use mkdir to create the required directories, then use cp, mv, and rm for the file operations.
  • You may use ls, pwd, and cd to navigate and verify your progress.
  • All commands must be executed in the terminal.
  • Create a src and a config directory to organize the files.

Initial Structure

Your ~/project directory initially contains the following:

project/
├── old_stuff/
│   ├── deprecated_script.sh
│   └── outdated_notes.txt
├── temp/
│   ├── draft_readme.md
│   └── config_backup.json
├── app.js
├── styles.css
└── data.json

Target Structure

Your goal is to achieve the following structure:

project/
├── src/
│   ├── app.js
│   └── styles.css
├── config/
│   └── config.json
└── README.md

Remember, your task is to create the required directories with mkdir, then achieve the target structure using cp, mv, and rm. Use ls and pwd to check your progress as needed.

Summary

In this challenge, you practiced using three essential Linux commands: cp for copying files, mv for moving files and directories, and rm for removing files and directories. You reorganized a project structure, demonstrating how these commands are used in real-world scenarios. By manipulating files and directories to achieve a specific layout, you've enhanced your skills in file system operations. These abilities are crucial for managing projects, organizing files, and maintaining clean directory structures in Linux environments.

✨ Check Solution and Practice