Skip to content
Programming contents

Lesson 2.2.4: Installing programs

Every system comes with a package manager: you tell it which program you want and it downloads and installs it.

The idea

A package manager installs programs for you: you tell it the name, it downloads and installs it.

  • Linux (Ubuntu, Debian) comes with apt.
  • Windows 10 and 11 come with winget.

We'll try it with Git, which you'll use in 2.5. On macOS, the most used manager is Homebrew, installed separately.

On Linux

Linux · Bash
sudo apt update
sudo apt install git
  • sudo runs the command as administrator. It asks for your password and, while you type it, nothing shows, not even asterisks. Type it and press Enter.
  • apt update refreshes the list of programs; apt install installs.
  • If it asks Do you want to continue? [Y/n], press Enter.

On Windows

Windows · PowerShell
winget install Git.Git
  • Git.Git is the package name. If you don't know it, winget search git finds it.
  • The first time it asks whether you accept the terms: type Y and press Enter.
  • If Windows asks for permission in a window, accept.
  • When it's done, close the terminal and open another. The one that was open can't see the new program.

Is it there?

The same command on both:

Terminal
git --version
Terminal
git version 2.51.0

Your number may be different. What matters is that one shows up.

If it isn't

The terminal looks for programs in a list of folders, the PATH. If it can't find one:

Linux · Bash
git --version
Terminal
bash: git: command not found
Windows · PowerShell
git --version
Terminal
git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program.

Two causes: it isn't installed, or the terminal was opened before installing it. Ubuntu also tells you what to install.

Try it

Exercise

Install Git with your system's package manager and check the version. Then misspell the name, gti --version, and read the answer.

Show the solution
Linux · Bash
sudo apt update
sudo apt install git
git --version
gti --version
Terminal
git version 2.51.0
bash: gti: command not found
Windows · PowerShell
winget install Git.Git

Close the terminal, open another and carry on:

Windows · PowerShell
git --version
gti --version
Terminal
git version 2.51.0.windows.1
gti : The term 'gti' is not recognized as the name of a cmdlet, function, script file, or operable program.

A typo gives the same error as a missing program. Before installing anything, check how you wrote it.

Summary

  • A package manager installs programs: apt on Linux, winget on Windows.
  • On Linux, sudo asks for your password and doesn't show it.
  • On Windows, after installing, open a new terminal.
  • program --version checks it's there.