Setup: The Terminal on Windows

Install Ubuntu inside Windows with WSL, open it in Windows Terminal, add bats, and learn where your Windows files are from Ubuntu and where your practice files belong.

Novice · Unix · Linux · Updated

After this lesson you can

  • Choose the steps that install Ubuntu with WSL and open it in Windows Terminal
  • Find your Windows files from Ubuntu under /mnt/c, and keep your practice files in your Ubuntu home folder

Key takeaways

  • WSL runs a real Ubuntu inside Windows. wsl --install, typed in Terminal (Admin), sets it up.
  • Windows Terminal opens Ubuntu in a tab. Make Ubuntu its default profile, so every new window starts there.
  • Your C drive is /mnt/c inside Ubuntu, so C:\Users\Sam\Documents is /mnt/c/Users/Sam/Documents.
  • Keep your practice files in Ubuntu's home folder (~), where Linux commands work as they would on a server.

Windows has terminals of its own, but bash lives on Linux, and so do the servers this course's later modules look after. WSL, the Windows Subsystem for Linux, gives you both: a real copy of Ubuntu, a popular Linux, running inside Windows, in a window beside your other apps. Every command in this course then works on your computer exactly as it does on a Linux server. Setting it up takes about twenty minutes and one restart. (On a Mac or Linux? Setup: The Terminal on a Mac or Setup: The Terminal on Linux is your lesson instead.)

Install WSL and Ubuntu

This step changes Windows itself, so it needs administrator rights, and Windows asks you to confirm. Right-click the Start button and choose Terminal (Admin), then click Yes. In the window that opens, type:

wsl --install

This is the one line you type into PowerShell, Windows' own shell; everything after it happens in Ubuntu. It turns WSL on and downloads Ubuntu. When it says so, restart your computer.

After the restart, Ubuntu finishes installing in a window of its own and asks you to make a user name and password for Linux. They don't need to match your Windows ones. Use a short lowercase name, such as sam. Nothing shows on the screen while you type the password; type it anyway and press Enter. Remember it: Ubuntu asks for it whenever you install software.

You can also install Ubuntu from the Microsoft Store: search for Ubuntu and click Get. wsl --install does the same in one line.

Open Ubuntu in Windows Terminal

Windows Terminal comes with Windows 11 (on Windows 10, get it free from the Microsoft Store). It's one window that holds many shells in tabs: Ubuntu, PowerShell and others. Open it, click the down arrow beside the tabs, and choose Ubuntu.

Windows Terminal with its drop-down menu open under the tabs, listing the shells it can open, with Ubuntu highlighted

To start in Ubuntu every time, open Settings (Ctrl+comma), choose Startup, set Default profile to Ubuntu, and click Save.

Add bats

From here on, you're in Ubuntu, so you install software the Ubuntu way, with apt, its package manager. The course's exercises are checked by bats. sudo (read "sue-doo") runs one command as the administrator; it asks for the Linux password you made a moment ago:

sudo apt update
sudo apt install bats

If apt asks whether to continue, press Y, then Enter. Then check it worked:

bats --version

It prints Bats and a version number, such as Bats 1.13.0 on Ubuntu 26.04.

Where your Windows files are

Windows writes a path like C:\Users\Sam\Documents, with a drive letter and backslashes (\). Linux has no drive letters: everything is in one tree, starting at / (read "slash"), with forward slashes between folders. Ubuntu puts your C drive at /mnt/c:

cd /mnt/c
pwd
/mnt/c

So C:\Users\Sam\Documents is /mnt/c/Users/Sam/Documents in Ubuntu. That's handy for reaching a file you downloaded in Windows.

It works the other way too. Ubuntu's own files appear in File Explorer under Linux, then Ubuntu, and typing explorer.exe . in Ubuntu opens the folder you're in, in File Explorer.

Keep your practice files in Ubuntu's own home folder, ~ (read "tilde", or "home"), not in /mnt/c. Linux commands are much faster there, and file names and permissions behave exactly as they would on a server.

Make your practice folder

Every lesson works in one practice folder, terminal-practice, in your Ubuntu home folder, so nothing you try touches your real files. Make it, go into it, and ask where you are:

mkdir -p ~/terminal-practice
cd ~/terminal-practice
pwd
/home/sam/terminal-practice

You'll see your own Linux user name instead of sam. mkdir makes a folder (Module 2 covers it), cd moves you into it, and pwd says where you are (both are in the next chapter).

Check yourself

2 questions to try on the lesson page.

So what

You now have a real Linux inside Windows: Ubuntu in Windows Terminal, apt for installing tools, bats for exercise checks and a practice folder in your Linux home. From here on, every lesson works for you exactly as it does on Linux.

Key terms

Cheat sheets

Related