{"id":1654,"date":"2012-01-14T14:06:40","date_gmt":"2012-01-14T06:06:40","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1654"},"modified":"2023-04-28T09:49:58","modified_gmt":"2023-04-28T09:49:58","slug":"how-to-install-which-command-on-centos","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-which-command-on-centos\/","title":{"rendered":"How to Install Which Command On CentOS"},"content":{"rendered":"<p>The which command is a helpful utility for finding the location of executable files in the system&#8217;s PATH. It is useful for determining the binary file being executed when multiple versions of the same program are installed or for troubleshooting purposes.<\/p>\n<pre>\r\n[root@geeks ~]# which grep\r\n-bash: which: command not found\r\n<\/pre>\n<p>In this short tutorial, we&#8217;ll explain how to install the which command on CentOS.<\/p>\n<h2>Step 1: Update Your System<\/h2>\n<p>Before installing any new packages, it&#8217;s a good practice to update your system. To update your CentOS system, run the following command:<\/p>\n<pre>\r\nsudo yum update -y\r\n<\/pre>\n<h2>Step 2: Install Which Command<\/h2>\n<p>To install the which command on CentOS, run the following command:<\/p>\n<pre>\r\nsudo yum install which -y\r\n<\/pre>\n<p>This command installs the which package from the default CentOS repositories.<\/p>\n<pre>\r\n[root@CentOS57 ~]# yum install which\r\nLoaded plugins: fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * base: centos.ipserverone.com\r\n * extras: centos.ipserverone.com\r\n * updates: centos.ipserverone.com\r\nSetting up Install Process\r\nResolving Dependencies\r\n--> Running transaction check\r\n---> Package which.i386 0:2.16-7 set to be updated\r\n--> Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n===================================================================================================\r\n Package                Arch                  Version                  Repository             Size\r\n===================================================================================================\r\nInstalling:\r\n which                  i386                  2.16-7                   base                   23 k\r\n\r\nTransaction Summary\r\n===================================================================================================\r\nInstall       1 Package(s)\r\nUpgrade       0 Package(s)\r\n\r\nTotal download size: 23 k\r\nIs this ok [y\/N]: y\r\nDownloading Packages:\r\nwhich-2.16-7.i386.rpm                                                       |  23 kB     00:00\r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nFinished Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Installing     : which                                                                       1\/1\r\n\r\nInstalled:\r\n  which.i386 0:2.16-7\r\n\r\nComplete!\r\n<\/pre>\n<h2>Step 3: Verify Which Command Installation<\/h2>\n<p>After the installation is complete, you can verify that the which command is installed and working correctly by running it with a common command, such as ls:<\/p>\n<pre>\r\nwhich ls\r\n<\/pre>\n<p>The output should display the full path to the ls command, which typically looks like this:<\/p>\n<pre>\r\n\/usr\/bin\/ls\r\n<\/pre>\n<h2>Programs Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">which<\/span> &#8211; A utility for finding the location of executable files in the system&#8217;s PATH, used for troubleshooting and managing installed programs on Unix-like operating systems.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>In this guide, you have successfully installed the which command on your CentOS system. You can now use the which command to locate the full path of executable files in your system&#8217;s PATH, helping you troubleshoot and manage your installed programs more effectively.<\/p>\n<p>If you have any questions or suggestions for improvements, please feel free to comment and share your thoughts. We appreciate your feedback and strive to provide the most accurate and informative content possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The which command is a helpful utility for finding the location of executable files in the system&#8217;s PATH. It is useful for determining the binary file being executed when multiple&#8230;<\/p>\n","protected":false},"author":6,"featured_media":349,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1],"tags":[1244,1536,1997],"class_list":["post-1654","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-centos","tag-linux","tag-which"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1654"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1654\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/349"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}