{"id":23120,"date":"2023-10-31T07:35:29","date_gmt":"2023-10-31T07:35:29","guid":{"rendered":"https:\/\/linuxways.net\/?p=23120"},"modified":"2023-10-31T07:35:29","modified_gmt":"2023-10-31T07:35:29","slug":"search-for-available-packages-from-command-line-ubuntu","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/search-for-available-packages-from-command-line-ubuntu\/","title":{"rendered":"How to Search for Available Packages from the Command Line in Ubuntu?"},"content":{"rendered":"<p>The Ubuntu Operating System consists of a bunch of Packages Installed which can be listed by the User. In some cases, the user requires any additional packages, either as a dependency or to install the whole package on their Ubuntu System. For this reason, the Ubuntu user requires access to the repository to check for the available packages that they can install. The installed packages either crash or return an error where the user can no longer use that package. Thus, the need to see the available packages arises so that the user can Download, Troubleshoot, and keep their Ubuntu System Up-to-date.<\/p>\n<p>This article demonstrates the useful commands to list the available packages on Ubuntu through the Terminal\/Command Line.<\/p>\n<h2><strong>How to Search for Available Packages from the Command Line in Ubuntu?<\/strong><\/h2>\n<p>The \u201capt\u201d command, the \u201capt-cache\u201d command, and the \u201cdpkg\u201d commands are useful built-in Ubuntu Commands that can be used for various purposes including searching for Available Packages. Apart from these three commands, the \u201captitude\u201d is also a useful third-party tool used for searching for available packages on your Ubuntu System. To list available packages we will use the approaches mentioned below:<\/p>\n<ul>\n<li>Using the \u201capt search\u201d Method.<\/li>\n<li>Using the \u201capt list\u201d Method.<\/li>\n<li>Using the \u201cdpkg\u201d Method.<\/li>\n<li>Using the \u201capt-cache\u201d Method.<\/li>\n<li>Using the \u201captitude\u201d Method.<\/li>\n<\/ul>\n<h2><strong>List Available Packages Using the \u201capt-cache\u201d Command<\/strong><\/h2>\n<p>To list the available packages in the Terminal, the \u201capt-cache\u201d is among the widely used commands. It can be used to list all the available packages that you can install on your Ubuntu System as well and you can use it to search for a specific available package using the name of the package. The \u201capt-cache\u201d Command has the syntax:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-cache search<\/span> <span class=\"sy0\">&lt;<\/span>option<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>Both procedures for listing all available packages as well as listing specific packages are discussed below.<\/p>\n<h2><strong>List All Available Packages<\/strong><\/h2>\n<p>To list all the available packages on your Ubuntu Terminal, the \u201capt-cache\u201d command is used along with the search command and the dot(<strong>.<\/strong>) option:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-cache search<\/span> .<\/div><\/div>\n<p>The dot(<strong>.<\/strong>) option will list all the available packages that you can install on your Ubuntu System:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"478\" class=\"wp-image-23121\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-1.gif\" \/><\/p>\n<h2><strong>List Available Packages by Name<\/strong><\/h2>\n<p>Instead of listing all the available packages on the Terminal, you can list specific available packages as well. Along with the \u201csearch\u201d command, by specifying the Package Name, the Command line will list only the Available Packages of the specified name:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-cache search<\/span> <span class=\"sy0\">&lt;<\/span>packageName<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, to search for all the available packages of \u201cPHP\u201d, the \u201capt-cache\u201d command will be:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">apt-cache search<\/span> PHP<\/div><\/div>\n<p>The Terminal will display all the PHP Packages that are available:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1011\" height=\"484\" class=\"wp-image-23122\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-2.png 1011w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-2-300x144.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-2-768x368.png 768w\" sizes=\"auto, (max-width: 1011px) 100vw, 1011px\" \/><\/p>\n<h2><strong>List Available Packages Using the \u201capt search\u201d Command<\/strong><\/h2>\n<p>The simple \u201capt\u201d command is also a useful way to list the available packages for your Ubuntu System. It searches from the list of available packages and lists the dependency packages as well. The \u201capt\u201d command is used along with the \u201csearch\u201d command and the name of the Package you want to search:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt search <span class=\"sy0\">&lt;<\/span>packageName<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, to list the available \u201cfirefox\u201d packages from the available packages, the \u201capt search\u201d command is:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt search firefox<\/div><\/div>\n<p>The Terminal will display all the available packages of Firefox:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"915\" height=\"481\" class=\"wp-image-23123\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-3.png 915w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-3-300x158.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-3-768x404.png 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\" \/><\/p>\n<p>Now, the \u201capt\u201d command can also be used to list available packages without listing the dependencies packages too. This will list only the packages containing the package name in it. In our case, to list the packages only containing the Firefox package name, the \u201cgrep\u201d command is used along with the \u201capt\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt search firefox <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> firefox<\/div><\/div>\n<p>The Terminal will only list the Available Firefox Packages without dependencies:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"917\" height=\"483\" class=\"wp-image-23124\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-4.png 917w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-4-300x158.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-4-768x405.png 768w\" sizes=\"auto, (max-width: 917px) 100vw, 917px\" \/><\/p>\n<h2><strong>List Available Packages Using the \u201capt list\u201d Command<\/strong><\/h2>\n<p>The \u201capt list\u201d is another useful command to display all the available, upgradeable, and installed packages in the Terminal. To list the available packages using the \u201clist\u201d command, the \u201capt\u201d command can simply be used as<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt list<\/div><\/div>\n<p>The Terminal will display all the available, installed, and upgradeable packages:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1031\" height=\"478\" class=\"wp-image-23125\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-5.gif\" \/><\/p>\n<p>You can also list specific installed, available, and upgradeable packages on your Ubuntu System by specifying the Package Name:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt list <span class=\"sy0\">&lt;<\/span>packageName<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, we will list all the available, installed, and upgradeable packages of \u201cpython3\u201d using the \u201capt list\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt list python3<\/div><\/div>\n<p>The installed and available packages of \u201cpython3\u201d will be listed in the Terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"98\" class=\"wp-image-23126\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-6.png 908w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-6-300x32.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-6-768x83.png 768w\" sizes=\"auto, (max-width: 908px) 100vw, 908px\" \/><\/p>\n<p>You can also list only the upgradeable packages using the \u201capt list\u201d command with the \u201c&#8211;installed\u201d option:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">apt list <span class=\"re5\">--upgradeable<\/span><\/div><\/div>\n<p>Only the upgradeable packages will be listed in the Terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1036\" height=\"384\" class=\"wp-image-23127\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-7.png 1036w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-7-300x111.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-7-1024x380.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-7-768x285.png 768w\" sizes=\"auto, (max-width: 1036px) 100vw, 1036px\" \/><\/p>\n<h2><strong>List Available Packages Using the \u201cdpkg\u201d Command<\/strong><\/h2>\n<p>The \u201cdpkg\u201d command lists the available packages in a new window mode inside the Terminal. To list all the available packages with the \u201cdpkg\u201d command, the \u201c-l\u201d option is used:<\/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>The new Terminal Window will display all the installed, available, and upgradeable packages:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1041\" height=\"485\" class=\"wp-image-23128\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-8.png 1041w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-8-300x140.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-8-1024x477.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-8-768x358.png 768w\" sizes=\"auto, (max-width: 1041px) 100vw, 1041px\" \/><\/p>\n<p>You can see more packages by pressing the down \u201c<strong>\u2193<\/strong>\u201d arrow:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1442\" height=\"476\" class=\"wp-image-23129\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-9.gif\" \/><\/p>\n<p>To quit this menu, press \u201cq\u201d.<\/p>\n<h2><strong>Search Available Packages with the \u201cdpkg\u201d Command According to a Pattern<\/strong><\/h2>\n<p>You can also use the \u201cdpkg\u201d to Search for packages that end with a specific query 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\">-l<\/span> <span class=\"st_h\">'*&lt;endingWords&gt;'<\/span><\/div><\/div>\n<p>In our case, we will list all the packages that end with the word \u201ccommon\u201d using the \u201cdpkg\u201d 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> <span class=\"st_h\">'*common'<\/span><\/div><\/div>\n<p>As you can see in the Terminal, only the packages ending with \u201ccommon\u201d are listed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1441\" height=\"478\" class=\"wp-image-23130\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-10.png 1441w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-10-300x100.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-10-1024x340.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-10-768x255.png 768w\" sizes=\"auto, (max-width: 1441px) 100vw, 1441px\" \/><\/p>\n<p>You can also search for packages that start with a specific query using the \u201cdpkg\u201d 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> <span class=\"st_h\">'&lt;startingWords&gt;*'<\/span><\/div><\/div>\n<p>In our case, to list only the packages that start with the word \u201cfire\u201d, the \u201cdpkg\u201d command will be:<\/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> <span class=\"st_h\">'fire*'<\/span><\/div><\/div>\n<p>As you can see in the Terminal, only the packages starting with the \u201cfire\u201d word are listed:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1184\" height=\"321\" class=\"wp-image-23131\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-11.png 1184w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-11-300x81.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-11-1024x278.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-11-768x208.png 768w\" sizes=\"auto, (max-width: 1184px) 100vw, 1184px\" \/><\/p>\n<h2><strong>List Available Packages Using the \u201captitude\u201d Command<\/strong><\/h2>\n<p>The Aptitude is also a useful common line utility to list all the packages in the Terminal. It is not pre-installed on your Ubuntu System and can be installed using the \u201capt install\u201d command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> <span class=\"kw2\">aptitude<\/span><\/div><\/div>\n<p>Wait for the Aptitude Packages to be added to your Ubuntu System:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"405\" class=\"wp-image-23132\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-12.png 905w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-12-300x134.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-12-768x344.png 768w\" sizes=\"auto, (max-width: 905px) 100vw, 905px\" \/><\/p>\n<p>Once added, you can search for packages using the \u201captitude\u201d command along with the Package Name:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">aptitude search<\/span> <span class=\"sy0\">&lt;<\/span>packageName<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p>In our case, we will search for the packages of \u201cfirefox\u201d using the Aptitude command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">aptitude search<\/span> firefox<\/div><\/div>\n<p>The Terminal will display all the available packages of Firefox:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1007\" height=\"406\" class=\"wp-image-23133\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-13.png 1007w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-13-300x121.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/10\/word-image-23120-13-768x310.png 768w\" sizes=\"auto, (max-width: 1007px) 100vw, 1007px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>In some cases, the Installed packages either crash or return an error where you can no longer use that package and require the need to install a new package. Thus, before installing a new package, you have to check all the available packages either using the \u201capt search\u201d command, the \u201capt list\u201d command, the \u201capt-cache\u201d command, the \u201cdpkg\u201d command, or the \u201captitude\u201d command. This article explained the use of each command in detail.<\/p>","protected":false},"excerpt":{"rendered":"<p>Search all the available packages using the \u201capt search\u201d command, the \u201capt list\u201d command, the \u201capt-cache\u201d command, the \u201cdpkg\u201d command, or the \u201captitude\u201d command <\/p>","protected":false},"author":110,"featured_media":23134,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-23120","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\/23120","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=23120"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23120\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/23134"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=23120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=23120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=23120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}