Moving Around the Terminal
Goal — Navigate your file system and create the project folder you will use for the rest of the course.
By the end — A my-first-site folder with css and js subfolders, made entirely from the terminal.
Map first — Where am I in the file system, and where do I want to end up?
1See where you are
Run pwd to print your current folder — the working directory. This answers the first map question: where am I?
pwd2See what is around you
ls lists the files and folders in your current location. ls -la shows everything, including hidden files, with details.
lsls -la3Move into a folder
cd Documents moves into your Documents folder. Run pwd again to confirm you moved. cd .. goes back up one level — .. always means the folder above this one.
cd Documentscd ..4Create your project folder
Make sure you are in Documents, then create the project you will carry through the whole course and move into it.
cd Documentsmkdir my-first-sitecd my-first-site5Give the project some structure
Create two folders inside it in one command, then confirm both appear. This is the skeleton of a simple website — a place for styles and a place for scripts.
mkdir css jsls6Practice the file-moving basics
cp source.txt copy.txt duplicates a file. mv oldname.txt newname.txt renames; mv file.txt css/ moves it into the css folder. rm file.txt removes a file.
rm has no undo. Read the name twice before pressing enter.
7Read a file and clear the screen
cat filename prints a file's contents to the terminal. clear wipes the screen clean when it gets cluttered.
clearRecap — You can find where you are, see what is around you, move between folders, and you built my-first-site with css and js inside it — all from the terminal.