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:
The command first deletes any old playlist calles playlist.tmp under /tmp. After that it recursively searches all direcotries under ~/mp3 and stores the result in /tmp/playlist.tmp. After havin created the playlist, the command will execute mplayer which will shuffle through the playlist.
This command is aliased to
m is aliased to `rm -rf /tmp/playlist.tmp && find ~/mp3 -name *.mp3 > /tmp/playlist.tmp && mplayer -playlist /tmp/playlist.tmp -shuffle -loop 0 | grep Playing'
in my ~/.bashrc.
There are 3 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.
By the way: Can anybody figure out how to do the same thing without creating a temporary playlist? I tried to pass the results of find to mplayer via xargs, but then the keyboard controls of mplayer won't function any more....
What about 'find ~/mp3 -iname *.mp3 -exec mplayer -shuffle -loop {} \;' ? I am not at a *nix machine right now, so I can't test it, but something like this would not require a playlist.
The '-iname' option on find will help if you have mp3's where the extension is .MP3 as opposed to .mp3
My suggestion doesn't work, but I did google the problem with mplayer and found this: 'http://www.linuxquestions.org/questions/linux-software-2/xargs-mplayer-loses-key-controls-635170/' The suggested workaround only works for files with no spaces in them, but I'm sure there is some way to do it for all kinds of file names.
"find blablabla | mplayer -playlist -" will build a playlist from stdin. Also, you should write "\*.mp3" instead of simply "*.mp3", otherwise your shell will expand * before it gets to find, and find will get a list of *-mp3's in cwd
@philtomson: I found the same page yesterday but had not idea how to make it work...
@ benjamin:
find ~/mp3 -name "*.mp3" | mplayer -playlist - -shuffle -loop 0does not allow to control mplayer with keyboard any more.... e.g. "next song" by hitting return... :/
Here's a better version which filters out all "audio books":
rm -rf /tmp/playlist.tmp && find ~/mp3 -name *.mp3 -not -name 'H?rb?cher' > /tmp/playlist.tmp && mplayer -playlist /tmp/playlist.tmp -shuffle -loop 0 | grep PlayingOkay, this works:
for i in "$(find . -type d)";do d=( $i/*.mp3 ); files=( "${files[@]}" "${d[@]}" );done; mplayer -shuffle -loop 0 "${files[@]}"ugly as hell though :D
Sin!!! That's a big one...