Updated: Revised answer to clarify not for non-package installs
If you installed using the manual installation which was listed first on youtube-dl github page, then this method will allow you to use youtube-dl
with your custom name youtubedl
, without seeing youtube-dl
in auto-completion. On your terminal:
$ cd /usr/local/bin/
$ sudo mv youtube-dl youtubedl
You may now use it using its new name youtubedl
, try it with the test video:
$ youtubedl -F 'https://www.youtube.com/watch?v=BaW_jenozKc'
You may also upgrade in the future:
$ youtubedl -U
Warranty
- Versions:
2016.01.15
, renaming and then upgrading to 2016.04.05
. See youtube-dl --version
- Tested only with youtube-dl installed using the manual install instructions at the youtube-dl github page, not tested with package install methods. So this answer may not work if youtube-dl was installed with a package management system that might have the install location hard-coded
Explanation
The youtube-dl github page instructions followed were:
$ sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl
- This downloads
youtube-dl
binary to /usr/local/bin
.
- Paths within
$PATH
appear on auto-completion.
/usr/local/bin
is indeed one such path in $PATH
, thus youtube-dl
will appear in Bash auto-completion.
So to rename what appears in Bash auto-completion, one way is to rename the binary itself. We visit the binary's location:
$ cd /usr/local/bin/
Rename:
$ sudo mv youtube-dl youtubedl
/usr/local/bin
is a restricted directory, so we use sudo
The old name will no longer be found:
$ which youtube-dl
youtube-dl not found
And we can now refer to it by the new name:
$ which youtubedl
/usr/local/bin/youtubedl
We can test it still works, for example upgrade with -U
:
$ youtubedl -U
Updating to version 2016.04.05 ...
Updated youtube-dl. Restart youtube-dl to use the new version.
Test its video functionality such as retrieving formats:
$ youtubedl -F 'https://www.youtube.com/watch?v=BaW_jenozKc' | head
[youtube] BaW_jenozKc: Downloading webpage
[youtube] BaW_jenozKc: Downloading video info webpage
[youtube] BaW_jenozKc: Extracting video information
[youtube] BaW_jenozKc: Downloading MPD manifest
[info] Available formats for BaW_jenozKc:
format code extension resolution note
249 webm audio only DASH audio 47k , opus @ 50k, 57.05KiB
250 webm audio only DASH audio 66k , opus @ 70k, 79.56KiB
171 webm audio only DASH audio 74k , vorbis@128k (44100Hz), 89.59K
iB
140 m4a audio only DASH audio 127k , m4a_dash container, mp4a.40.2
@128k (44100Hz), 154.06KiB
From the source code update.py
, line 86:
filename = sys.argv[0]
- So this update code detects the current program's file name, thus allowing you to have
yourcustomname -U
and still successfully be able to update.
bin
directory to your $PATH that has an executable script namedyoutubedl
which simply exec's youtube-dl; you would have to type "youtubedTAB
" to get past the dash, though. – Jeff Schaller Apr 05 '16 at 19:19EXECIGNORE=*/youtube-dl
should do what you want. – Richard Waite Apr 08 '18 at 18:20