How to use apt-get command in Professional Way :-
APT, short for Advanced package Tool, is a package management system. APT allows you to quickly and easily install, update, and remove software from the command line. Aside from its simplicity, one of the best things about APT is the face that it automatically resolves dependency issues for you. This means that if the package you are installing requires additional software, APT will automatically locate and install the additional software. This is a massive improvement over the old days of “ dependency hell” .
Installing software with APT is very straightforward. For example, let us assume you want to install the classic network-mapping tool Cheops. Once you know the name of the package you want to install, from the command line you can run apt-get install followed by the name of the software you want to install. It is always a good idea to run apt-get update before installing software. This will insure that you are getting the latest version available.
To install Cheops, we would issue the following commands :-
Apt-get install cheops
Apt-get command line may be a variation of the following basic types:-
1. apt-get update
The update command fetched the packages from their locations and update the packages to newer version.
2. apt-get upgrade
The ‘upgrade‘ command is used to upgrade all the currently installed software packages on the system. Under any circumstances currently installed packages are not removed or packages which are not already installed neither retrieved and installed to satisfy upgrade dependencies.
3. apt-get dist-upgrade
same as apt-get upgrade, but installs all base packages and tries to upgrade everything, installing new packages if needed .
4. Re-installing packages
$ apt-get –reinstall install < package-name >
The –reinstall option re-install packages that are already installed and at the newest version.
The following command will reinstall rsync package. Open a terminal and then type:-
$ sudo apt-get –reinstall install rsync
# apt-get –reinstall install rsync
5. apt-get remove some-package
Removes the some-package package and all other packages that depends on it. When you use the command apt-get remove <package> it removes that package from the system but leaves behind config files for that package.
for complete removal ( i.e. with configuration file )
$ apt-get –purge remove < package-name >
6. apt-get clean
The ‘clean‘ command is used to free up the disk space by cleaning retrieved (downloaded) .deb files (packages) from the local repository.
Check the article How do “apt-get clean” and “apt-get clean all” differ .
7. apt-get install packageName –only-upgrade
The ‘–only-upgrade‘ command do not install new packages but it only upgrade the already installed packages and disables new installation of packages.
8. install Packages without Upgrading
Using sub ‘–no-upgrade‘ command will prevent already installed packages from upgrading.
$ sudo apt-get install packageName –no-upgrade
9. Install Multiple Packages
You can add more than one package name along with the command in order to install multiple packages at the same time. For example, the following command will install packages ‘nethogs‘ and ‘goaccess‘.
$ sudo apt-get install nethogs goaccess
10. Check statistics of Cache
The ‘stats‘ sub command will display overall statistics about the cache. For example, the following command will display Total package names is the number of packages have found in the cache.
$ apt-cache stats
Enjoy the apt-get command.
Hope you like my post.How to use apt-get command in Professional Way. Please Share with others.