How it works
Permissive licences such as MIT, BSD and Apache 2.0 let anyone use the code in any product, closed-source ones included, as long as the copyright notice is kept; Apache 2.0 adds an explicit patent grant. Copyleft licences such as the GPL require anyone who distributes a modified version to share its source under the same terms, and the AGPL extends that to software offered over a network.
Code published with no licence is not free to use: by default all rights are reserved. Some projects have moved to source-available licences such as the SSPL or the Business Source License, which restrict competing hosted services and are not approved by the Open Source Initiative. Before shipping a commercial product it is worth listing every dependency's licence, which tools can do automatically.
Related terms
More in Dev workflow and DevOps
Code and collaboration