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/
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.
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
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:
It will just start playing and will not stop at the point that it has downloaded up to when the video starts
Improvement on Coderjoe's Solution. Gets rid of grep and cut (and implements them in awk) and specifies some different mplayer options that speed things up a bit.
Creates a better looking gif than the original post via imagemagick processing high quality jpgs, rather than converting directly to gif from the video itself.
Better awk example, using only mplayer, grep, cut, and awk.
So... I saw this: http://www.commandlinefu.com/commands/view/5385/play-all-the-music-in-a-folder-on-shuffle
And I thought it would be cool to make it so that it will play songs in subdirectorys too.
from: http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2011-March/067853.html
Google text-to-speech in your local language or in language of choice via country code switch (ISO 639-1).
Usage examples:
say hello
say "hello world"
say hello+world
this command example converts to 25 fps subtitles that were originally created for 24 fps movie
Works really well for playing DVDs, which have the volume turned way down for some reason. The `2' method is better IMHO because it will adjust to changing loud/soft parts.
If you want to add it to your ~/.mplayer/config:
# format: volnorm[=method:target]
# method:
# 1: use single sample (default)
# 2: multiple samples
# target:
# default is 0.25
af-add=volnorm=2:0.75
Skip forward and back using the < and > keys. Display the file title with I.
requires sp-auth installed
This command will auto kill sp-sc after vlc is closed, so u wont have to do it manually
It's made for a script use, where you have 3 parameters:
1. parameter is the filename
2. (optional) the encoding for subtitles
3. (optional) the scaling of the video, since fullscreen doesn't mean that the video will be scaled.
The solution to a year long (and extremely frustrating) problem I've had, caused by the fact that I only have one speaker; this command downmixes the stream to monophonic output, making sure I don't miss any of the music.
NOTE: When stream is in .m3u format, a -playlist option is required, as shown below:
mplayer -af pan=1:0.5:0.5 -channels 1 -playlist radiostream.m3u
This command works great with aliases for various channels in .bashrc. Sample below:
alias radio1='mplayer -af pan=1:0.5:0.5 -channels 1 radio1stream.pls'
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)
Streams youtube video with v=ID directly into the mplayer.
If exists, it uses the HD-quality stream.
If you don't want to watch it in HD-quality, you can use the shorter form:
ID=52DnUo6wJto; mplayer -fs $(echo "http://youtube.com/get_video.php?&video_id=$ID$(wget -qO - 'http://youtube.com/watch?v='$ID | perl -ne 'print $1."&asv=" if /^.*(&t=.*?)&.*$/')")
requires "youtube-dl" -- sure you can do this with wget and some more obscurity but why waste your time when this great tool is available?
the guts consist of mplayer converting a video to a gif -- study this command and read the man page for more information
mplayer video.flv -ss 00:23 -endpos 6 -vo gif89a:fps=5:output=output.gif -vf scale=400:300 -nosound
generates a 6 second gif starting at 23 seconds of play time at 5 fps and a scale of 400x300
start time (-ss)/end time (-endpos) formats: 00:00:00.000
end time should be relative to start time, not absolute. i.e. -endpos 5 == seconds after 0:42 = 0:47 end point
play with fps and scale for lower gif sizes
the subshell is a solution for the -b flag on youtube-dl which downloads the best quality video, sometimes, which can be various video formats $(ls ${url##*=}*| tail -n1)
This is a very simple and lightweight way to play DI.FM stations
For a more complete version of the command with proper strings in the menu, try: (couldnt fit in the command field above)
zenity --list --width 500 --height 500 --title 'DI.FM' --text 'Pick a Radio' --column 'radio' --column 'url' --print-column 2 $(curl -s http://www.di.fm/ | awk -F '"' '/href="http:.*\.pls.*96k/ {print $2}' | sort | awk -F '/|\.' '{print $(NF-1) " " $0}') | xargs mplayer
This command line parses the html returned from http://di.fm and display all radio stations in a nice graphical menu. After the radio is chosen, the url is passed to mplayer so the music can start
dependencies:
- x11 with gtk environment
- zenity: simple app for displaying gtk menus (sudo apt-get install zenity on ubuntu)
- mplayer: simple audio player (sudo apt-get install mplayer on ubuntu)
Press > or < to go to the next or previous track. Space to toggle play/pause, etc.
It creates a temp file descriptor. To see where the file descriptor gets created type: echo <(echo foo)
This works better than running find first, then piping to mplayer with xargs or something, because that won't let you use keyboard shortcuts.