Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Stream YouTube URL directly to MPlayer

Terminal - Stream YouTube URL directly to MPlayer
yt () mplayer -fs -quiet $(youtube-dl -g "$1")
2010-09-29 18:48:19
User: elfreak
15
Stream YouTube URL directly to MPlayer

A function for streaming youtube to mplayer.

The option "-g" for youtube-dl tells it to output the direct video URL, instead of downloading the video.

"-fs" tells MPlayer to go FullScreen, and "-quit" makes it less verbose.

Requires: youdube-dl ( http://bitbucket.org/rg3/youtube-dl/ )

(Tested in zsh)

Alternatives

There are 5 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

now, if only I could define which monitor to output to...

Comment by zed 216 weeks and 1 day ago

-xineramascreen 1

:)

Comment by zed 216 weeks and 1 day ago

404 on your link

Comment by TheMightyBuzzard 216 weeks and 1 day ago

@TheMightyBuzzard:

Thank you, comandlinefu parsed the last parentheses as part of the URL.

Now fixed.

Comment by elfreak 216 weeks and 1 day ago

Unfortunately, this entry did not get listed as an alternative to the existing YouTube / MPlayer one-liners (my bad). Any way to do that now?

Comment by elfreak 216 weeks and 1 day ago

should I firs make an alias from this comand?

How should I invoke this? I will be appreciate for details.

Comment by noisy 216 weeks and 1 day ago

yt is a function. You either add it (as it is) to your .bashrc / .zshrc, or just paste it in a terminal (it will be available for that session only). After that, as you can see from the sample output, you invoke it by typing yt and the YouTube URL:

yt "http://www.youtube.com/watch?v=1ZvCqslpp6M"

(The quotation signs are needed because zsh interprets the '?' as a special character)

Comment by elfreak 216 weeks and 1 day ago

I don't get the usefulness of this command. I download videos for two reasons: 1. I one to keep them on my disc to watch them again later, and 2. When streaming on browser is slow.

So I don't get the point of this. If you're going to stream it, then just see it on the browser.

Comment by conan 216 weeks ago

just what I was looking for. thanks :)

Comment by erikano 216 weeks ago

You use youtube-dl for those reasons, and if that's what you want, great ;) I made this function to avoid using YouTube's proprietary flash player. Here is a list, from the top of my head, of why: 1) I generally dislike flash, and I will do everything I can do to avoid it. 2) Fullscreen does not work well with my window manager (Xmonad). 3) I would like to be able to use my remote to control the video. 4) I want to be able to start a YouTube video on my mediapc (connected to the TV), from any of my computers. (I just SSH and give yt the link (probably going to make a script to automate that). 5) I want to be able to view YouTube videos without having X11. 6) I regularly do not want to store the videos, since I usually only watch them once. If it lags, then I will download it to /tmp. 7) I regularly do not want to wait while the video is downloading. The beauty with YouTube is that they have a massive collection of videos, instantly available to you. Bottom-line, if YouTube's proprietary flash player works for you, that's wonderful; otherwise, here's an alternative :)

Comment by elfreak 216 weeks ago

Wow! This is great! It works perfectly!

Comment by unixmonkey12633 216 weeks ago

I have added "-vo null" option in mplayer so it does not stream video when I listen to music only! This way it does not fil in the cache quickly. (:

Comment by KoboYagee 60 weeks and 4 days ago

Your point of view

You must be signed in to comment.

Related sites and podcasts