Getting Familiar with the Terminal
In this activity, you’ll get more practice with terminal commands.

Terminal Commands
Directories
List Directoryls Displays the content of the current directory. ls -la List the detailed contents of the current directory, including hidden files.Print Working Directorypwd Displays the path to the directory you’re currently in.Change Directorycd / Open the / folder. This folder must be present in your current directory. cd .. Navigate to the parent directory which is indicated by... This command essentially exits the current folder and brings you to the folder that contains it. cd ~ Navigate to the root directory.Make Directorymkdir / Make a new folder with the name /Remove Directoryrm -r / Delete the folder / and all the files within it.Copy Directorycp -r / / Copies / and its contents into /. If there is already a folder named / within /, the contents of the folder that was already present will be overwritten by the / you’re copying into the folder.Move Directorymv / / Move / into /. This will not work if there is already a folder in / with the name /. mv / .. Move / into the parent directory...always refers to the parent directory
Files
Create Filetouch / Create a new / in the current directory. Remember to include the file extension. If there is already a file with the name /, it will just update the last modified time of the file.Delete Filerm / Deletes the file with the name /.Copy Filecp / / Copies the / into the / folder. If there is already a file named /, the file that is already present will be overwritten by the new / you’re copying in.Rename Filemv / / Renames a file named / into /Move Filemv / / Move a file named / into the / folder. If there is already a file named /, the file that is already present will be overwritten by the new / you’re moving in.
Utility
Clear Screenclear Clears the terminal screen so you don’t have to sift through the previous inputs.Previous Command↑ Use the up arrow to navigate to previous commands you’ve used in terminal.Tab Completion[Tab ↹] Use theTabbutton to autocomplete the current file or directory you’re typing in. If there’s multiple names that can be completed from what you currently have typed, it will autocomplete up to the point where the names diverge. You can use tab completion again afterwards if you’ve narrowed down which name you’re typing.Closing a processPC [Ctrl] + c Mac [Control] + c This ends the current process that’s running in your terminal. This could be themanualornodeor any of the many things that may take up the terminal window.
Instructions
- Open the terminal in this folder.
- Use the
lscommand to see the contents of this folder. - Use the
pwdcommand to find the current path you’re in. - Create a new directory named
Activity-1. Then list the contents of the current directory again, to make sure it worked. - Navigate into the directory you just created.
- Create a new file named
hello.md. List the contents of the current directory again. - Copy the file you just made to a file named
world.md. - Rename the
hello.mdfile tocoding.md. - Create a new directory named
terminal. - Move the
world.mdfile into theterminalfolder you just made. - Delete the
terminalfolder.
Hint
Use the terminal cheat sheet to help guide you on which terminal commands should be used for each step.
Solution
To start with, let’s open up the terminal in this folder.

Let’s see what’s in the folder! Use the ls command to see the contents of this folder.

What’s the current path we’re in? Let’s find out with the pwd command. Note: Notice that the path you’re currently at is the folder where you right clicked to start git bash.

Make a new directory named Activity-1 and then list the contents of the current directory again to make sure it worked.

Navigate into the directory we just made.

Make a new file named hello.md and then list the contents of the current directory again.

Copy the file you just made to a filed named world.md.

Rename the hello.md file to coding.md.

Make a new directory named terminal.

Move the world.md file into the terminal folder we just made.

