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
sudo apt update
sudo apt install git
sudoruns 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 updaterefreshes the list of programs;apt installinstalls.- If it asks
Do you want to continue? [Y/n], press Enter.
On Windows
winget install Git.Git
Git.Gitis the package name. If you don't know it,winget search gitfinds it.- The first time it asks whether you accept the terms: type
Yand 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:
git --version
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:
git --version
bash: git: command not found
git --version
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
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
sudo apt update
sudo apt install git
git --version
gti --version
git version 2.51.0
bash: gti: command not found
winget install Git.Git
Close the terminal, open another and carry on:
git --version
gti --version
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:
apton Linux,wingeton Windows. - On Linux,
sudoasks for your password and doesn't show it. - On Windows, after installing, open a new terminal.
program --versionchecks it's there.