Linux and Bash course menu
How to Get a Linux Terminal on Windows or Mac
Practise Linux without leaving Windows: install WSL, use a virtual machine, a free cloud shell, or the Mac terminal, and open your first Bash prompt.
On this page
You do not need to replace Windows to learn Linux. Choose one of these.
Windows: install WSL#
WSL (Windows Subsystem for Linux) runs a real Linux system inside Windows. Open PowerShell as administrator, and run:
wsl --installRestart when asked. Ubuntu then opens and asks you to create a username and password. This Linux user is separate from your Windows account.
To open it later, search for Ubuntu in the Start menu. Update it once:
sudo apt update
sudo apt upgradeYour Windows drives are available under /mnt/c. Keep practice files in your Linux home folder, where commands run faster.
macOS#
Open Terminal. macOS is based on Unix, so most commands work, but its default shell is zsh, and some tools have different options. The lessons on systemd, apt and some sed options need a real Linux system, so use a virtual machine or Codespaces for those.
Virtual machine#
Install VirtualBox, download the Ubuntu LTS image from ubuntu.com, and create a new machine with at least 4 GB of memory and 25 GB of disk.
GitHub Codespaces#
With a GitHub account, open any repository and choose Code, then Codespaces, then Create codespace. You get a Linux terminal in your browser, and GitHub's free plan includes a monthly allowance.
Check your terminal#
Run these three commands:
whoami
hostname
echo $SHELLasha
laviyx
/bin/bashYou will see your own username and computer name. If the last line ends in bash, you are ready.
The prompt#
Before each command, the terminal shows a prompt:
asha@laviyx:~$In this course, the prompt is left out, so that you can copy the commands directly.
Keyboard shortcuts#
Use Tab all the time. It saves typing and prevents mistakes.
Common mistakes#
Key takeaway#
Next: Your First Commands.
Finished this lesson?