
Instructions
Step 1: Open Terminal in your VS code editor.
Step 2: Type the command mkdir lab and press Enter
Step 3: Change to the lab directory by typing cd lab and pressing Enter
Step 4: Type the command touch file1.txt and press Enter to create a file named file1.txt
Step 5: Type the command mkdir dir1 and press Enter
Step 6: Type the command mv file1.txt dir1/ and press Enter to move file1.txt to the dir1 directory
Step 7: Type the command touch file2.txt and press Enter to create a file named file2.txt
Step 8: Type the command mkdir -p dir2/dir3 and press Enter. We're using the -p flag to create the parent directories if they do not exist. In this case it will create the dir2 directory and then create the dir3 directory inside of dir2.
Step 9: Type the command mv file2.txt dir2/dir3/ and press Enter to move file2.txt to the dir3 directory
Step 10: Change to the dir2 directory by typing cd dir2
Step 11: Type the command touch file3.txt and press Enter to create a file named file3.txt
Step 12: Type the command mv file3.txt ../ and press Enter to move file3.txt to the lab directory
Step 13: Type the command cd .. and press Enter to navigate back to the lab directory
Step 14: Type the command cd dir1 and press Enter.
Step 15: Type the command ls -l and press Enter. Note how many files and directories are in the dir1 directory.
Step 16: Type the command cd ../dir2 and press Enter.
Step 17: Type the command ls -l and press Enter. Note how many files and directories are in the dir2 directory.
Step 18: Type the command cd dir3 and press Enter.
Step 19: Type the command ls -l and press Enter. Note how many files and directories are in the dir3 directory.
Here's a step-by-step guide based on your instructions:
Step-by-Step Guide
Open Terminal in VS Code:
Open VS Code.
Open the terminal by navigating to
View>Terminalor by using the shortcutCtrl+` (Control + Backtick).
Create a Directory named
lab:In the terminal, type:
mkdir labPress
Enter.
Change to the
labDirectory:Type:
cd labPress
Enter.
Create a File named
file1.txt:Type:
touch file1.txtPress
Enter.
Create a Directory named
dir1:Type:
mkdir dir1Press
Enter.
Move
file1.txttodir1:Type:
mv file1.txt dir1/Press
Enter.
Create a File named
file2.txt:Type:
touch file2.txtPress
Enter.
Create Nested Directories
dir2anddir3:Type:
mkdir -p dir2/dir3Press
Enter.
Move
file2.txttodir3:Type:
mv file2.txt dir2/dir3/Press
Enter.
Change to the
dir2Directory:Type:
cd dir2Press
Enter.
Create a File named
file3.txt:Type:
touch file3.txtPress
Enter.
Move
file3.txtto the Parent Directory (lab):Type:
mv file3.txt ../Press
Enter.
Navigate Back to the
labDirectory:Type:
cd ..Press
Enter.
Change to the
dir1Directory:Type:
cd dir1Press
Enter.
List Files and Directories in
dir1:Type:
ls -lPress
Enter.Note the files and directories listed.
Change to the
dir2Directory:Type:
cd ../dir2Press
Enter.
List Files and Directories in
dir2:Type:
ls -lPress
Enter.Note the files and directories listed.
Change to the
dir3Directory:Type:
cd dir3Press
Enter.
List Files and Directories in
dir3:Type:
ls -lPress
Enter.Note the files and directories listed.
By following these steps, you will create directories and files, move them around, and list their contents to verify the changes.
About the author
A passionate full-stack developer from @ePlus.DEV
Comments
Join the discussionNo comments yet. Be the first to comment.






