Recap: File Management
Chapter 2 gave you the full file-management toolkit. Time to use all of it in one build.
| Command | Job |
|---|---|
mkdir (-p) | create folders |
touch | create empty files |
cp (-r) | copy files and folders |
mv | move and rename |
rm (-r), rmdir | delete files and folders |
A project folder almost always starts the same way: make the directories, then put
files into them. Plan the structure first, then build it step by step. Use ls and
tree between steps to check your work.
Mission: New Mission Scaffold
A new deep-space survey mission has been approved and needs a proper project directory before the science team can start uploading data. You also need to clean up leftover junk from the last officer's shift.
- Create a folder called
project. - Inside it, create two sub-folders in a single step:
project/srcandproject/docs. - Inside
project/src, create an empty file calledmain.sh. - Copy the existing
template.txtintoproject/docs/readme.txt. - Delete the leftover
junk.txtfrom your home directory.
Expected result
project/src contains main.sh, project/docs/readme.txt holds the template text, and junk.txt no longer exists in your home directory.