World map

 

BM: Baca dalam Bahasa Melayu

World 0: Start Here

Terminal basics

You will learn: four commands to find your way around the terminal.

The problem

Someone types cd Music, then ls. The terminal answers: playlist.txt. Terminal output: $ cd Music $ ls playlist.txt

Git lives in the terminal: A window where you type commands to your computer.. No mouse, no icons. Just words. How do you find your way around?

Watch

pwd prints /home/you. Terminal output: $ pwd /home/you

pwd asks: where am I? The answer is a path, like an address for folders. Here, you are home: /home/you.

Watch

ls lists Documents and Music in blue, and notes.txt in plain text. Terminal output: $ ls Documents Music notes.txt

ls asks: what’s in here? Blue names are folder (directory): A place that holds files and other folders.. The others are files.

Watch

cd Documents moves you into Documents. Now pwd prints /home/you/Documents. Terminal output: $ cd Documents $ pwd /home/you/Documents

cd means change directory. Directory is another word for folder. cd Documents walks into Documents. cd .. walks back out.

Try it

Go into Documents. Then list what’s inside.

Watch

mkdir projects makes a new folder. Now ls shows Documents, Music, notes.txt and projects. Terminal output: $ mkdir projects $ ls Documents Music notes.txt projects

mkdir means make directory. mkdir projects makes a new, empty folder called projects.

Try it

Make a folder called projects. Then go into it.

Predict

You are in /home/you. You type cd Music. What will pwd show?

Pick one answer.

You did it!

You can now find your way around with pwd, ls, cd and mkdir.

Go deeper (optional)

ls -a also shows hidden files. Their names start with a dot. cd ~ (or just cd) takes you home. mkdir -p makes folders inside folders in one go.

mkdir -p makes projects and diary inside it. cd ~ goes back home. Terminal output: $ mkdir -p projects/diary $ cd projects/diary $ pwd /home/you/projects/diary $ cd ~ $ pwd /home/you