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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
This turns your iptables packet filter to a "Allow any from any to any" filter, so you can rule out any filtering issues when you have a problem to enable a connection from or to your host.
To re-enable it, run /etc/init.d/iptables restart
You can watch channels of your freebox, everywhere. With " vlc http://your-ip:12345 " on the client and ncurses vlc interface on the host. et voila
Change files case, without modify directories, recursively.
... fucking vfat
Extensible to other ugly extensions like *.JPG, *.Jpg etc..
Leave out the last pipe to sh to perform a dry run.
To resize photos without changing exif datas, pretty cool for gps tagging.
This is useful for sending data between 2 computers that you have shell access to. Uses tar compression during transfer. Files are compressed & uncompressed automatically. Note the trailing dash on the listening side that makes netcat listen to stdin for data.
on the listening side:
sudo nc -lp 2022 | sudo tar -xvf -
explanation: open netcat to -l listen on -p port 2022, take the data stream and pipe to tar -x extract, -v verbose, -f using file filename - means "stdin"
on the sending side:
tar -cvzf - ./*| nc -w 3 name_of_listening_host 2022
explanation: compress all files in current dir using tar -c create, -v verbose, -f using file, - filename - here means "stdout" because we're tar -c instead of tar -x, -w3 wait 3 seconds on stream termination and then end the connection to the listening host name_of_listening_host, on port 2022
Allows you to save progress without committing.
To revert to an undo point, svn revert then apply the undo point with patch.
svn revert -R . && patch -p0 < .undo/2009-03-27_08:08:11rev57
The above was done using the i386 flashplayer plugin, and was installed on a AMD64 machine running an AMD64 kernel and AMD64 programs. the resulting plugin install ultimately didn't work for swiftfox (but worked for iceweasel) without also covering it with a nspluginwrapper which took a bit of fenangaling to get to work (lots of apt-getting) but it is a nice feature to be able to trick installers that think you need i386 into running on a amd64, or at least attempting to run on amd64. Enjoy
If you put this in your .bashrc, you might also want to add this to make it use the colors by default:
alias ls="ls --color=auto"
This is useful for piping to other commands, as well:
svn status | egrep '^(M|A)' | egrep -o '[^MA\ ].*$' | xargs $EDITOR
I got really tired of having tree always show me tons of .svn and .git stuff that I don't care about. With this alias, "tree" uses pretty colors, snazzy line graphics, and ignores any source control and package mumbojumbo. (Customize the *.*.package glob, of course.)
Good old cat & output redirection. Using this method you can combine all kinds of things - even mpeg files. My video camera makes a series of .mpeg files that are broken into 4gb chunks. Using this command I can easily join them together. Even better, combined with the cp command the files can be copied and joined in one step.
I wrote a script called bootstrap.py to delete the database, then load a new database with initial values. With this single-line shell loop, when I need to make a schema change (which happens often in the early stages of some projects), I hit ctrl-C to stop the running Django server, then watch bootstrap.py do its thing, then watch the server restart.
This is useful if you have a collection of files in folders (for example, a bunch of .zip files that are contained in folders) and you want to move them all to a common folder.
Assuming you are working within a git repository, you can run the above command & see what has changed in reverse chronological order, with one commit per line. Other formatting variations to 'oneline' include 'short', 'medium', 'full', 'fuller', 'email' or 'raw'.
Seems obvious, but other seemingly simple ways to use it don't work:
-bash: !whammy: event not found
with the slash :(
you can also do any combinations of quotes for a complex string:
echo "It's great to be able to use a bang ("'!'") in a command"'!'
It's great to be able to use a bang (!) in a command!
I love CiteULike. It makes keeping a bibtex library easy and keeps all my papers in one place. However, it can be a pain when I add new entries and have to go through the procedure for downloading the new version in my browser, so I made this to grab it for me! I actually pipe it directly into a couple of SED one liners to tidy it up a bit too. Extremely useful, especially if you make a custom BibTeX script that does this first. That way you can sort a fresh BibTeX file for each new paper with no faf.
To use just replace with your CiteULike user name. It doesn't download entries that you've hidden but I don't use that feature anyway.
Use Ctrl-] to stop it.
The idea was originally stolen from Linux Journal. 'wget' pulls the debt clock and 'sed' reformats it for general consumption. Prefacing the command with 'watch' simply sets an interval - in this case every 10 seconds.