{"id":22063,"date":"2023-10-01T16:09:35","date_gmt":"2023-10-01T16:09:35","guid":{"rendered":"https:\/\/linuxways.net\/?p=22063"},"modified":"2023-10-01T16:09:35","modified_gmt":"2023-10-01T16:09:35","slug":"how-to-use-apt-get-to-install-programs-in-ubuntu-from-the-terminal","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-use-apt-get-to-install-programs-in-ubuntu-from-the-terminal\/","title":{"rendered":"How to Use Apt-Get to Install Programs in Ubuntu from the Terminal?"},"content":{"rendered":"<p>The \u201c<strong>apt-get<\/strong>\u201d command manages the packages in Ubuntu by retrieving information about those packages. The \u201capt-get\u201d simplifies the installation, handling, deletion, and overall management of libraries and packages. This article discusses the apt-get command to install packages in Ubuntu.<\/p>\n<h2><strong>How to Use Apt-Get to Install Programs in Ubuntu From the Terminal?<\/strong><\/h2>\n<p>The apt-get is a simplified way to download and install packages or programs from official repositories with ease. To install programs in Ubuntu using the \u201capt-get\u201d command, follow the steps below.<\/p>\n<h3><strong>Step 1: Open Terminal<\/strong><\/h3>\n<p>Start the terminal by clicking on the \u201cShow Applications\u201d icon at the bottom left of the home screen:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1080\" class=\"wp-image-22089\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-1-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-1-1.png 1920w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-1-1-300x169.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-1-1-1024x576.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-1-1-768x432.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-1-1-1536x864.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>The Applications Menu Open and you will see the Search Bar. Click on it and type the application you want to search for. In our case, we will search for \u201cTerminal\u201d:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"444\" class=\"wp-image-22093\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-2-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-2-1.png 1920w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-2-1-300x69.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-2-1-1024x237.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-2-1-768x178.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-2-1-1536x355.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p>Click on the Terminal to Open it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"243\" class=\"wp-image-22099\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-3-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-3-1.png 731w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-3-1-300x100.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p>The shortcut key \u201c<strong>ctrl+alt+t<\/strong>\u201d can also be utilized to open the Terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1514\" height=\"460\" class=\"wp-image-22106\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-4-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-4-1.png 1514w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-4-1-300x91.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-4-1-1024x311.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-4-1-768x233.png 768w\" sizes=\"auto, (max-width: 1514px) 100vw, 1514px\" \/><\/p>\n<h3><strong>Step 2: Update Existing Packages<\/strong><\/h3>\n<p>Once the Terminal is opened, update the existing packages before installing a new package using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get update<\/span><\/div><\/div>\n<p>This will update the existing Ubuntu packages:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"444\" class=\"wp-image-22113\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-5-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-5-1.png 727w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-5-1-300x183.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/p>\n<p>Upgrade the packages that are updated using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get upgrade<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"167\" class=\"wp-image-22116\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-6-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-6-1.png 728w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-6-1-300x69.png 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/p>\n<h3><strong>Step 3: Search for Packages<\/strong><\/h3>\n<p>The \u201capt-cache\u201d command searches for packages. To use the \u201capt-cache\u201d command, the search command is used with it as well as the package name to be searched:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-cache search<\/span> <span class=\"sy0\">&lt;<\/span>package-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, to search for the \u201cblender\u201d application, the \u201capt search\u201d command will be:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-cache search<\/span> blender<\/div><\/div>\n<p>The packages containing the keyword \u201cblender\u201d will be listed in the Terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1138\" height=\"292\" class=\"wp-image-22119\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-7-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-7-1.png 1138w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-7-1-300x77.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-7-1-1024x263.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-7-1-768x197.png 768w\" sizes=\"auto, (max-width: 1138px) 100vw, 1138px\" \/><\/p>\n<h3><strong>Step 4: Install the Package using Apt-Get<\/strong><\/h3>\n<p>The Packages in Ubuntu can be installed using the \u201capt-get\u201d command with \u201cinstall\u201d followed by the package name to be installed. Once the desired package is searched using the \u201capt-cache search\u201d command, the package can be installed using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> <span class=\"sy0\">&lt;<\/span>package-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, we previously searched for the \u201cblender\u201d package and among those packages to download and install the \u201cblender\u201d package, the command used will be:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> blender<\/div><\/div>\n<p>The Blender package will start downloading, wait for the completion:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1142\" height=\"550\" class=\"wp-image-22122\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-8-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-8-1.png 1142w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-8-1-300x144.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-8-1-1024x493.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-8-1-768x370.png 768w\" sizes=\"auto, (max-width: 1142px) 100vw, 1142px\" \/><\/p>\n<h3><strong>Step 5: Verify Package Installation<\/strong><\/h3>\n<p>The packages installed can be verified using the \u201cdpkg\u201d command in Ubuntu. To display all the packages installed in Ubuntu, use the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">dpkg<\/span> <span class=\"re5\">-l<\/span><\/div><\/div>\n<p>All the packages will be listed in the Terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1143\" height=\"593\" class=\"wp-image-22127\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-9-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-9-1.png 1143w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-9-1-300x156.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-9-1-1024x531.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-9-1-768x398.png 768w\" sizes=\"auto, (max-width: 1143px) 100vw, 1143px\" \/><\/p>\n<p>The \u201cdpkg\u201d command with \u201c&#8211;get-selections\u201d is also a useful way to list all the installed packages in Ubuntu using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">dpkg<\/span> <span class=\"re5\">--get-selections<\/span><\/div><\/div>\n<p>All the Installed packages will be listed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1151\" height=\"582\" class=\"wp-image-22134\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-10-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-10-1.png 1151w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-10-1-300x152.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-10-1-1024x518.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-10-1-768x388.png 768w\" sizes=\"auto, (max-width: 1151px) 100vw, 1151px\" \/><\/p>\n<p>You can also filter for a specific package using the \u201cgrep\u201d command along with the \u201cdpkg\u201d command. To find a specific installed package, the command used is:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">dpkg<\/span> <span class=\"re5\">--get-selections<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"sy0\">&lt;<\/span>package-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, as we installed \u201cblender\u201d previously, we will use the \u201cgrep\u201d command to search for the blender packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">dpkg<\/span> <span class=\"re5\">--get-selections<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> blender<\/div><\/div>\n<p>The blender packages installed will be returned to the terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1146\" height=\"80\" class=\"wp-image-22138\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-11-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-11-1.png 1146w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-11-1-300x21.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-11-1-1024x71.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-11-1-768x54.png 768w\" sizes=\"auto, (max-width: 1146px) 100vw, 1146px\" \/><\/p>\n<p>Thus the packages are installed. You can also verify by launching the application either by searching for the application through the GUI or opening it directly from the terminal using the name of the application. In our case, we will type \u201cblender\u201d in the terminal and hit \u201cEnter\u201d to launch the application:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1152\" height=\"143\" class=\"wp-image-22140\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-12-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-12-1.png 1152w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-12-1-300x37.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-12-1-1024x127.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-12-1-768x95.png 768w\" sizes=\"auto, (max-width: 1152px) 100vw, 1152px\" \/><\/p>\n<p>If the application launches it verifies the installation of the packages:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1080\" class=\"wp-image-22160\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-13-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-13-1.png 1920w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-13-1-300x169.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-13-1-1024x576.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-13-1-768x432.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-13-1-1536x864.png 1536w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<h2><strong>Bonus Step 1: Uninstalling Package<\/strong><\/h2>\n<p>The packages installed can also be uninstalled when required using the terminal. When the package is no longer required, it can be uninstalled:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get remove<\/span> <span class=\"sy0\">&lt;<\/span>package-name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, to remove or uninstall Blender from our system, we will use the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get remove<\/span> blender<\/div><\/div>\n<p>This will uninstall the blender packages and ask for confirmation. Enter \u201cY\u201d to continue uninstalling:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1147\" height=\"622\" class=\"wp-image-22165\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-14-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-14-1.png 1147w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-14-1-300x163.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-14-1-1024x555.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-14-1-768x416.png 768w\" sizes=\"auto, (max-width: 1147px) 100vw, 1147px\" \/><\/p>\n<h2><strong>Bonus Step 2: Cleaning System after Uninstalling<\/strong><\/h2>\n<p>It is good to clean up the Ubuntu system ensuring no files are left behind after uninstalling a package using the command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get autoclean<\/span><\/div><\/div>\n<p>This will clean the system and if any packages are left after deleting or uninstalling, will be removed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1156\" height=\"370\" class=\"wp-image-22168\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-15-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-15-1.png 1156w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-15-1-300x96.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-15-1-1024x328.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-22063-15-1-768x246.png 768w\" sizes=\"auto, (max-width: 1156px) 100vw, 1156px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>The apt-get command can be used to search for a specific package and then install those packages using the install command with \u201capt-get\u201d. The \u201capt-get\u201d command also removes or uninstalls the packages from the Ubuntu system as well as auto cleans after removing packages. This article explained the procedure to use the apt-get command for various purposes.<\/p>","protected":false},"excerpt":{"rendered":"<p>The apt-get command can be used to install, remove packages, and autoclean Ubuntu System from Terminal. It can also be used with \u201ccache\u201d to search for packages. <\/p>","protected":false},"author":110,"featured_media":22065,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-22063","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/22063","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\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=22063"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/22063\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/22065"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=22063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=22063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=22063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}