Code / Command Line & Git / Unit 1: The terminal: finding your way

Hello, terminal नमस्ते, टर्मिनल

Lesson 1 of 12 · about 10 minutes · What a terminal is, pwd, whoami, ls and hidden files.

⚡ 0 XP

Step 1 of 2

Talking to the computer in words

~$ mkdir shop~$ cd shop~/shop$ ls

Normally you click icons. A terminal lets you type what you want instead: one command per line, press Enter, and the computer answers. Developers love it because it is fast, exact and easy to repeat.

The practice terminal on this page is simulated and safe: nothing touches your real computer, so experiment freely. You are the user asha, and your home folder is /home/asha.

The line before your cursor is the prompt, like asha@indiadigital:~$. The ~ means "my home folder".

  • pwd = print working directory (where am I?)
  • whoami = which user am I?
  • help = list the commands this practice terminal knows

On a real computer the same commands work in the Terminal app on macOS and Linux. On Windows, install Git Bash (it comes with Git for Windows) to get the very same commands.

Example
pwd
whoami
help

Try typing your own commands too!

🎯 Challenge: Where am I? Who am I? +10 XP

Run pwd to print your current folder (it should show /home/asha), then run whoami to print your user name.

Try twice to unlock the solution (0/2)

terminalCtrl ⏎
Loading editor…
…
Checklist

Press Run to check your code.

  • You ran pwd
  • The terminal showed /home/asha
  • You ran whoami
Lesson notes (text version)

1. Talking to the computer in words

Normally you click icons. A terminal lets you type what you want instead: one command per line, press Enter, and the computer answers. Developers love it because it is fast, exact and easy to repeat.

The practice terminal on this page is simulated and safe: nothing touches your real computer, so experiment freely. You are the user asha, and your home folder is /home/asha.

The line before your cursor is the prompt, like asha@indiadigital:~$. The ~ means "my home folder".

  • pwd = print working directory (where am I?)
  • whoami = which user am I?
  • help = list the commands this practice terminal knows

On a real computer the same commands work in the Terminal app on macOS and Linux. On Windows, install Git Bash (it comes with Git for Windows) to get the very same commands.

                pwd
whoami
help
              

Challenge: Where am I? Who am I?

Run pwd to print your current folder (it should show /home/asha), then run whoami to print your user name.

2. ls: what is in here?

ls lists the files and folders where you are. Folders are shown with a / at the end, like shop/.

Some files start with a dot, like .secret.txt. They are hidden: plain ls skips them. Add the flag -a (all) to see everything: ls -a.

You will also see ./ (this folder) and ../ (the folder above). Real projects hide settings this way, for example the .git folder you will meet later.

                ls
ls -a
              

Challenge: Find the secret masala recipe

Your home folder has a hidden recipe file. First run ls (you will not see it), then run ls -a so the hidden .secret-masala.txt shows up.

Search by task, format or tool name.