Apt-Get: Difference between revisions
Brodriguez (talk | contribs) (Create page) |
Brodriguez (talk | contribs) (Add section for removing package sources) |
||
Line 30: | Line 30: | ||
** '''<keyword>''' - The string to compare with. | ** '''<keyword>''' - The string to compare with. | ||
* Ex: If you want to see what nvidia drivers are available, you can type <code>apt-cache search nvidia</code> to display all matches with "nvidia". | * Ex: If you want to see what nvidia drivers are available, you can type <code>apt-cache search nvidia</code> to display all matches with "nvidia". | ||
== Removing Package Sources == | |||
Sometimes (rarely), a package source will become depreciated and cause errors when running <code>apt-get update</code>. Other times, you'll decide you no longer want a previously installed third party package, and you'll want to stop checking the package repo for updates. | |||
In either case, you can find and remove the given source url from <code>/etc/apt/sources.list</code> or <code>/etc/apt/sources.list.d</code>. |
Revision as of 05:07, 8 October 2019
The terminal command apt-get is the preferred means to update and install packages for an Ubuntu system.
Apt Vs Apt-Get
This command apt is essentially shorthand for apt-get. All the main functionality of apt-get is present in atp, and the missing missing functions are ones that the average user never would have used anyways.
The command apt also aims to be "more pleasant for end users", but as result, the output might not be as useful for things like scripts.
Essentially:
- In most cases, apt and apt-get can be fully interchanged.
- Apt is pretty safe to use as the default, if only because it's less characters to type.
- Apt-Get should be used in the rare occurrence that apt is missing functionality you need (You'll likely know if this is the case).
- Apt-Get should be used for scripting purposes, particularly if the script cares about the command's output.
Updating Packages
To search for updates of known packages:
sudo apt update
To apply found updates:
sudo apt upgrade
To remove files made obsolete from new updates:
sudo apt autoremove
Searching through Known Packages
If you don't know the exact name of a program you want to install, you can search through apt's known repositories with the following:
apt-cache search <keyword>
- <keyword> - The string to compare with.
- Ex: If you want to see what nvidia drivers are available, you can type
apt-cache search nvidia
to display all matches with "nvidia".
Removing Package Sources
Sometimes (rarely), a package source will become depreciated and cause errors when running apt-get update
. Other times, you'll decide you no longer want a previously installed third party package, and you'll want to stop checking the package repo for updates.
In either case, you can find and remove the given source url from /etc/apt/sources.list
or /etc/apt/sources.list.d
.