[SOLVED] /usr/local/bin in #PATH, yet command of program there does not work
UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572
Rep:
/usr/local/bin in #PATH, yet command of program there does not work
Hi. I'm using Ubuntu 16.04. I generally only use packages, but the older version of youtube-dl that was available in the xenial repositories was too old and did not work. So, I ported the source package from zesty to my system, and this was fine for a while. The latest available package from doing this was youtube-dl 2017.03.26-1. However, this ceased to work. I discovered that there is a more recent version of this package available, so I decided to install that (though there was not an ubuntu package available of the most recent version -- that version being 2017.04.28). The installation was done as described here, specifically with curl. This installed youtube-dl into my /usr/local/bin path. However, the command "youtube-dl" does not work. Instead, I must use the command "/usr/local/bin/youtube-dl" to get it to work. Here's a readout from "echo #PATH" command:
So, I don't know why the "youtube-dl" command alone is not working.
Code:
mark@mark-N150-N210-N220:~$ youtube-dl
bash: /usr/bin/youtube-dl: No such file or directory
mark@mark-N150-N210-N220:~$ /usr/local/bin/youtube-dl
Usage: youtube-dl [OPTIONS] URL [URL...]
youtube-dl: error: You must provide at least one URL.
Type youtube-dl --help to see a list of all options.
mark@mark-N150-N210-N220:~$
The most likely reason is that bash still has the old /usr/bin location in its hash table. You can see it by running "hash -l".You can clear the hash table by running "hash -r" or (easier to remember) "PATH=$PATH" since assigning to PATH also clears the hash table.
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572
Original Poster
Rep:
Thanks rknichols. Here's what I get from the "hash -l" command. I'm not sure what exactly this means, but just in looking at it, I'm surprised that such an insignificant program as youtube-dl would be included with programs like apt or dpkg.
Thanks rknichols. Here's what I get from the "hash -l" command. I'm not sure what exactly this means, but just in looking at it, I'm surprised that such an insignificant program as youtube-dl would be included with programs like apt or dpkg.
That hash table has nothing to do with "significance". Every time the shell uses $PATH to find where a command resides, it saves the result in that hash table so that it does not have to perform that search if you use that command again. The entries in that table are just the commands from $PATH directories that you have used in that shell session.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.