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:
This one uses hex conversion to do the converting and is in shell/sed only (should probably still use the python/perl version).
Converts reserved characters in a URI to their percent encoded counterparts.
Alternate python version:
echo "$url" | python -c 'import sys,urllib;print urllib.quote(sys.stdin.read().strip())'
The function will take a comma separated list of items to be 'selected' by xsel -i:
smenu "First item to paste,Paste me #2,Third menu item"
You will then be prompted to choose one of the menu items. After you choose, you will be able to paste the string by clicking the middle mouse button.
The menu will keep prompting you to choose menu items until you break out with Control-C.
Set up X forwarding in PuTTY, with X display location set to :0.0
Launch PuTTY ssh session.
Launch Xming. Make sure that display is set to :0.0 (this is default).
echo "I'm going to paste this into WINDERS XP" | xsel -i
will insert the string into the windows cut and paste buffer.
Thanks to Dennis Williamson at stackoverflow.com for sharing...
I absolutely love this website, and appreciate every contribution. This is the first place I go when I'm stuck, you all have some great ideas. But contributions seem to be slipping a little. If all of us could contribute more code from time to time, this site would be absolutely incredible. Since I'm a relative newcomer to commandline-fu, I don't have the knowledge to contribute much, but I will do what I can.
Works recusivley in the specified dir or '.' if none given.
Repeatedly calls 'find' to find a newer file, when no newer files exist you have the newest.
In this case 'newest' means most recently modified. To find the most recently created change -newer to -cnewer.
If you want edit your sqlite database in any uft8 supported editor, you can dump whole sqlite database to plain text.
you know the song... sing along
setup for reminder in 5 days, added the date in the future. To run a job at 4pm three days from now, you would do at 4pm + 3 days, to run a job at 10:00am on July 31, you would do at 10am Jul 31 and to run a job at 1am tomorrow, you would do at 1am tomorrow.
If you need to randomize the lines in a file, but have an old sort commands that doesn't support the -R option, this could be helpful. It's easy enough to remember so that you can create it as a script and use that.
It ain't real fast. It ain't safe. It ain't super random. Do not use it on untrusted data. It requires bash for the $RANDOM variable to work.
A similar version for Bash that doesn't require cut and shortens the function in a few places. And it uses local variables. (similar to a version by eightmillion in a comment on the another version)
Add an alias to your .bashrc that allows you to issue the command xkcd to view (with gwenview) the newest xkcd comic... I know there are thousands of them out there but this one is at least replete with installer and also uses a more concise syntax... plus, gwenview shows you the downloading progress as it downloads the comic and gives you a more full featured viewing experience.
Makes sure the contents of "myfile" are the same contents that the author intended given the author's md5 hash of that file ("c84fa6b830e38ee8a551df61172d53d7").
The loop is to compare cookies. You can remove it...
Maybe you wanna use curl...
curl www.commandlinefu.com/index.php -s0 -I | grep "Set-Cookie"
if you, like me, do not have the numsum, this way can do the same.
I must monitorize a couple of ftp servers every morning WITHOUT a port-scanner
Instead of ftp'ing on 100 ftp servers manually to test their status I use this loop.
It might be adaptable to other services, however it may require a 'logout' string instead of 'quit'.
The file ftps.txt contains the full list of ftp servers to monitorize.