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.
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:
Bash process substitution which curls the website 'hashbang.sh' and executes the shell script embedded in the page.
This is obviously not the most secure way to run something like this, and we will scold you if you try.
The smarter way would be:
Download locally over SSL
> curl https://hashbang.sh >> hashbang.sh
Verify integrty with GPG (If available)
> gpg --recv-keys 0xD2C4C74D8FAA96F5
> gpg --verify hashbang.sh
Inspect source code
> less hashbang.sh
> chmod +x hashbang.sh
Requires aria2c but could just as easily wget or anything else.
A great way to build up a nice font collection for Gimp without having to waste a lot of time. :-)
Ever compress a file for the web by replacing all newline characters with nothing so it makes one nice big blob?
It is a great idea, however what about when you want to edit that file? ...Serious pain in the butt.
I ran into this today in that my only copy of a CSS file was "compressed" with no newlines.
I whipped this up and it converted back into nice human readable CSS :-)
It could be nicer, but it does the job.
This is the result of a several week venture without X. I found myself totally happy without X (and by extension without flash) and was able to do just about anything but watch YouTube videos... so this a the solution I came up with for that. I am sure this can be done better but this does indeed work... and tends to work far better than YouTube's ghetto proprietary flash player ;-)
Replace $i with any YouTube ID you want and this will scrape the site for the _real_ URL to the full quality .FLV file on Youtube's server and will then will hand that over to mplayer (or vlc or whatever you want) to be streamed.
In some browsers you can replace $i with just a % or put this in a shell script so all YouTube IDs can be handed directly off to your media player of choice for true streaming without the need for Flash or a downloader like clive. (I do however fully recommend clive if you wish to archive videos instead of streaming them)
If any interest is shown I would be more than happy to provide similar commands for other sites. Most streaming flash players use similar logic to YouTube.
Edit: 05/03/2011 -
Updated line to work with current YouTube. It could be a lot prettier but I will probably follow up with another update when I figure out how to get rid of that pesky Grep. Sed should take that syntax... but it doesn't.
Original (no longer working) command:
mplayer -fs $(echo "http://youtube.com/get_video.php?$(curl -s $youtube_url | sed -n "/watch_fullscreen/s;.*\(video_id.\+\)&title.*;\1;p")")