{"id":19146,"date":"2023-01-12T07:41:50","date_gmt":"2023-01-12T07:41:50","guid":{"rendered":"https:\/\/linuxways.net\/?p=19146"},"modified":"2023-10-19T02:25:53","modified_gmt":"2023-10-19T02:25:53","slug":"apt-get-command-in-linux-complete-guide-2","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/apt-get-command-in-linux-complete-guide-2\/","title":{"rendered":"apt-get command in Linux [Complete Guide]"},"content":{"rendered":"<p>An apt-get command is a powerful tool that allows you to handle packages in a Linux system. apt-get command&#8217;s main task is to retrieve information and packages to authenticate for installation, upgradation, and removal of packages.<\/p>\n<p>The apt-get command is quite similar to the apt command with a similar command structure and serves almost the same purpose. However, there are some key differences between them and in this article, we are going to learn how to use the apt-get command and see its main differences from the apt command.<\/p>\n<p>Also read: <a href=\"https:\/\/linuxways.net\/de\/centos\/apt-command-in-linux-complete-guide\/\">apt command in Linux [Complete Guide]<\/a><\/p>\n<h2>apt vs apt-get<\/h2>\n<p>Both apt and apt-get commands aim to put all necessary tools in one place for managing packages in a Linux system. However, their major differences lie in the way the data is presented to the end user. The apt command has traditionally been the more intuitive of the commands, providing users with helpful progress bars, and are often easier to use.<\/p>\n<p>However, the apt-get command offers an array of different features that you can not get using the apt command. The apt and apt-get commands are also not backward compatible meaning although some of the syntaxes may be similar, the syntax for one may not always work on another. So, for any power user, it is worth spending some time grasping the basic commands of the apt-get command.<\/p>\n<h2>How to Use apt-get Command in Linux<\/h2>\n<p>Below is a detailed syntax for the apt-get command in Linux. We included helpful images to guide you along the way. We also included common tasks you can perform using the apt-get command like installing or removing packages.<\/p>\n<p>Syntax<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get<\/span> <span class=\"br0\">&#91;<\/span>option<span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span><span class=\"kw3\">command<\/span><span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>or<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get<\/span> <span class=\"br0\">&#91;<\/span>options<span class=\"br0\">&#93;<\/span> <span class=\"kw2\">install<\/span><span class=\"sy0\">|<\/span>remove package1 <span class=\"br0\">&#91;<\/span>package2 , package <span class=\"nu0\">3<\/span> \u2026.. <span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>or<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get<\/span> <span class=\"br0\">&#91;<\/span>options<span class=\"br0\">&#93;<\/span> <span class=\"kw3\">source<\/span> package1 <span class=\"br0\">&#91;<\/span>package2, package <span class=\"nu0\">3<\/span> \u2026.<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<h2>Installing packages using the apt-get command<\/h2>\n<p>Installing packages is fairly simple using the apt-get command. The syntax for it is as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get install<\/span> <span class=\"br0\">&#91;<\/span>package<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>You have to replace the package name with the software you want to install. If you are unsure about the exact name, you can either search on the web or press the first few letters and press the tab button. Here is an example of installing a text editor in Linux.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19147 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.54.16-pm-1024x666.png\" alt=\"\" width=\"1020\" height=\"663\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.54.16-pm-1024x666.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.54.16-pm-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.54.16-pm-768x499.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.54.16-pm.png 1464w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>You can also install the specific version of the software by using the following syntax.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get install<\/span> <span class=\"br0\">&#91;<\/span>package<span class=\"br0\">&#93;<\/span>=<span class=\"br0\">&#91;<\/span>version<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p>Here is an example of installing version 7.1 of the nano text editor in Linux.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19148 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.55.43-pm-1024x668.png\" alt=\"\" width=\"1020\" height=\"665\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.55.43-pm-1024x668.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.55.43-pm-300x196.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.55.43-pm-768x501.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.55.43-pm.png 1468w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>Once you run the apt-get install command you will be prompted with a confirmation of whether you want to install the packages, press \u201cY\u201d followed by enter to proceed with the installation.<\/p>\n<p>You can also install multiple packages using a single command by using the following syntax.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get install<\/span> <span class=\"br0\">&#91;<\/span>package1<span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>package2<span class=\"br0\">&#93;<\/span> <span class=\"br0\">&#91;<\/span>package3<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19149 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.00.37-pm-1024x673.png\" alt=\"\" width=\"1020\" height=\"670\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.00.37-pm-1024x673.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.00.37-pm-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.00.37-pm-768x505.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.00.37-pm.png 1460w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>In the example above, we used one apt-get command to install both vim and nano (text editors) in the system.<\/p>\n<p>You can also use the &#8211;download-only command to only download the packages but not install them.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get install<\/span> <span class=\"re5\">--download-only<\/span> <span class=\"br0\">&#91;<\/span>package_name<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19150 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.59.07-pm-1024x667.png\" alt=\"\" width=\"1020\" height=\"664\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.59.07-pm-1024x667.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.59.07-pm-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.59.07-pm-768x500.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.59.07-pm.png 1464w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h2>How to Remove Packages with apt-get<\/h2>\n<p>Removing packages works the same way, you initiate removal using the following command.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get remove<\/span> <span class=\"br0\">&#91;<\/span>package_name<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19151 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.57.14-pm-1024x671.png\" alt=\"\" width=\"1020\" height=\"668\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.57.14-pm-1024x671.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.57.14-pm-300x197.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.57.14-pm-768x504.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.57.14-pm.png 1464w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>If you also want to remove all other configuration files that the package may leave behind, use the following command.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get purge<\/span> <span class=\"br0\">&#91;<\/span>package_name<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19153 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.03.27-pm-1024x670.png\" alt=\"\" width=\"1020\" height=\"667\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.03.27-pm-1024x670.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.03.27-pm-300x196.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.03.27-pm-768x502.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.03.27-pm.png 1468w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19154 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.58.09-pm-1024x662.png\" alt=\"\" width=\"1020\" height=\"659\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.58.09-pm-1024x662.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.58.09-pm-300x194.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.58.09-pm-768x496.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-12.58.09-pm.png 1470w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h2>How to Update Using the apt-get command<\/h2>\n<p>It is essential to resynchronize the package index files and update the package repository before installing a package. By doing this, you can be confident the packages you install are current.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get update<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19155 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.02.38-pm-1024x667.png\" alt=\"\" width=\"1020\" height=\"664\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.02.38-pm-1024x667.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.02.38-pm-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.02.38-pm-768x500.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.02.38-pm.png 1464w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>You can also check for broken dependencies using the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get check<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19156 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.01-pm-1024x663.png\" alt=\"\" width=\"1020\" height=\"660\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.01-pm-1024x663.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.01-pm-300x194.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.01-pm-768x497.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.01-pm.png 1468w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<p>To upgrade all current packages use the following apt-get command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get upgrade<\/span><\/div><\/div>\n<p>However, if you want to update a specific package instead of all packages, simply type the name of the package you want to upgrade.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-get upgrade<\/span> <span class=\"br0\">&#91;<\/span>package<span class=\"br0\">&#93;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-19157 size-large\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.32-pm-1024x666.png\" alt=\"\" width=\"1020\" height=\"663\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.32-pm-1024x666.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.32-pm-300x195.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.32-pm-768x500.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/01\/Screen-Shot-2023-01-12-at-1.04.32-pm.png 1460w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/p>\n<h2>Advance apt-get commands in Linux<\/h2>\n<p>Apt-get command also offers an array of other useful options, some of the most used ones are as follows:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">-v<span class=\"sy0\">\/<\/span>--version \u2013 display the current version of <span class=\"kw2\">apt-get<\/span><\/div><\/div>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">-h<span class=\"sy0\">\/<\/span>--help \u2013 display a summary of options available, useful <span class=\"kw1\">for<\/span> remembering the syntax.<\/div><\/div>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"re5\">--no-download<\/span> \u2013 disable download of any packages.<\/div><\/div>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"re5\">--auto-remove<\/span> \u2013 Remove irrelevant packages from the system.<\/div><\/div>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"re5\">--show-progress<\/span> \u2013 Enhance the experience by including a progress bar that allows <span class=\"kw2\">users<\/span> to see progress through a progress bar.<\/div><\/div>\n<h2>Conclusion<\/h2>\n<p>The apt-get command in Linux is easy to remember and hardly requires any technical skills to implement. It is useful for managing packages and is a great alternative to the apt command we saw earlier.<\/p>","protected":false},"excerpt":{"rendered":"<p>An apt-get command is a powerful tool that allows you to handle packages in a Linux system. apt-get command&#8217;s main task is to retrieve information and packages to&hellip;<\/p>","protected":false},"author":111,"featured_media":19158,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1049,2],"tags":[],"class_list":["post-19146","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-commands","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/111"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=19146"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/19146\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/19158"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=19146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=19146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=19146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}