I upgraded binary youtube-dl following this instruction. locate seems to find it, not ls, and it cannot be invoked. What is happening?

/usr/bin $ sudo apt-get remove youtube-dl
/usr/bin $ sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
/usr/bin $ sudo chmod a+rx /usr/local/bin/youtube-dl
/usr/bin $ locate youtube-dl
/usr/bin $ youtube-dl --version
bash: /usr/bin/youtube-dl: No such file or directory
/usr/bin $ ls y*
yacc  ybmtopbm  yelp  yes  yuvsplittoppm  yuvtoppm
  • look at the curl command line in your printout – jsotola May 5 at 20:28

You downloaded with curl to /usr/local/bin/youtube-dl and have removed the old version from /usr/bin. locate is not up to date. Run /usr/local/bin/youtube-dl.

  • /local eluded me, that and your answer explains most of it. /usr/bin $ sudo updatedb [sudo] password for er: er@laptop /usr/bin $ locate youtube-dl /usr/local/bin/youtube-dl /var/lib/dpkg/info/youtube-dl.list /var/lib/dpkg/info/youtube-dl.postrm – Erwann May 5 at 22:19

locate is not "real time" : it scans the filesystem and remembers files and locations in its internal database. This is what's happening to you here when running :


You're served the outdated value of this file's location because the database has not (yet) been updated. You can force this with :

slocate -u

full details : https://ss64.com/bash/locate.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.