LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-28-2017, 09:51 AM   #1
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Rep: Reputation: 210Reputation: 210Reputation: 210
/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:

Code:
mark@mark-N150-N210-N220:~$ echo $PATH
/home/mark/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
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:~$
 
Old 04-28-2017, 10:04 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.

Last edited by rknichols; 04-28-2017 at 10:07 AM.
 
2 members found this post helpful.
Old 04-28-2017, 11:20 AM   #3
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Original Poster
Rep: Reputation: 210Reputation: 210Reputation: 210
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.

Code:
mark@mark-N150-N210-N220:~$ hash -l
builtin hash -p /usr/bin/dpkg dpkg
builtin hash -p /usr/bin/youtube-dl youtube-dl
builtin hash -p /usr/bin/apt apt
builtin hash -p /bin/netstat netstat
builtin hash -p /usr/bin/dpkg-buildpackage dpkg-buildpackage
builtin hash -p /usr/bin/sudo sudo
builtin hash -p /bin/mkdir mkdir
builtin hash -p /bin/ls ls
builtin hash -p /usr/bin/clear clear
mark@mark-N150-N210-N220:~$
Anyway, I ran the PATH=$PATH command, which cleared it. So, I'll see what happens... okay, the command "youtube-dl" on its own is working now.
 
Old 04-28-2017, 12:30 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by mark_alfred View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What adds /usr/local/bin to PATH to run a non-interactive ssh command? leniviy Red Hat 2 04-23-2013 05:48 AM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM
Can't move program files to /usr/local/bin/ asburyguy Linux - Newbie 4 04-03-2004 11:53 AM
/usr/local/kde/bin in PATH aeshley Linux - Newbie 2 05-23-2002 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 02:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration