Skip to main content

The Terminal: Talking to Your Computer Directly

beginner12 min readLesson 45 of 143

The command line is how developers drive tools like Git. Learn the handful of commands that cover everyday work.

Graphical file managers show folders as icons. The terminal shows the same filesystem as text β€” and lets you act on it with short commands. It looks intimidating and is actually the most predictable tool you will ever use.

The prompt and the working directory

Every terminal has a working directory β€” the folder you are currently "in". pwd (print working directory) shows where you are:

$ pwd
/Users/ada/projects

The five commands that matter

pwd               # where am I?
ls                # list files here
cd my-project     # change directory β€” into my-project
cd ..             # back up one level
mkdir new-site    # make a new folder

Windows' CMD/PowerShell uses dir instead of ls; everything else here works the same.

Paths: absolute vs relative

  • Relative (cd projects) β€” from where you are now
  • Absolute (cd /Users/ada/projects) β€” from the root of the disk

. means "this folder" and .. means "the parent" β€” cd .. climbs one level, ./index.html points at a file here.

Creating files and running programs

touch notes.txt       # create an empty file
node script.js        # run a program with an argument
git status            # another program: Git (next lesson)

The pattern is always: program name, then arguments. You already know this shape from console.log β€” the terminal is just a bigger version.

What you learned

  • The terminal is a text view of the same filesystem
  • pwd, ls, cd, mkdir, touch
  • Relative vs absolute paths; . and ..
  • Every command is a program plus arguments

Next: version control β€” why every line of code deserves an undo button.

Now practice

The Terminal: Talking to Your Computer Directly β€” PracticeHands-on practice for β€œThe Terminal: Talking to Your Computer Directly”: apply what you just learned in terminal-basics.1 challenge Β· Β· ~5 min