commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This will deal nicely with filenames containing newlines and will run one lzma process per CPU core. It requires GNU Parallel http://www.youtube.com/watch?v=OpaiGYxkSuQ
Really, you deserve whatever happens if you have a whitespace character in a file name, but this has a small safety net. The truly paranoid will use '-i'.
Essentially the same as funky's alias, but will not traverse filesystems and has nicer formatting.
Gnu grep allows to restrict the search to files only matching a given pattern. It also allows to exclude files.
I like this better than some of the alternatives using -exec, because if I want to change the string, it's right there at the end of the command line. That means less editing effort and more time to drink coffee.
The above output is for a custom compiled version of Vim on Arch Linux.
Just a quick shell one liner, and presents a list of all the enabled and disabled (those prefixed with a '-') features.
Query the Socrata Open Data API being used by the White House to find any employee's salary using curl, grep and awk.
Change the value of the search parameter (example uses Axelrod) to the name of any White House staffer to see their annual salary.
Quicker way to search man pages of command for key word
A Quick variation to the latest commands list with the new-lines skipped. This is faster to read.
I use this sometimes when ctags won't help.
I've been using it in a script to build from scratch proxy servers.
I use zgrep because it also parses non gzip files.
With ls -tr, we parse logs in time order.
Greping the empty string just concatenates all logs, but you can also grep an IP, an URL...
This should do the same thing and is about 70 chars shorter.
The ^python$ is a package name patten. You can change whatever you want.
-P tells grep to use perl regex matches (only works on the GNU grep as far as I know.)
The cut should match the relevant timestamp part of the logfile, the uniq will count the number of occurrences during this time interval.
Reports all local partitions having more than 90% usage.
Just add it in a crontab and you'll get a mail when a disk is full.
(sending mail to the root user must work for that)
Catches .swp, .swo, .swn, etc.
If you have access to lsof, it'll give you more compressed output and show you the associated terminals (e.g., pts/5, which you could then use 'w' to figure out where it's originating from): lsof | grep '\.sw.$'
If you have swp files turned off, you can do something like: ps x | grep '[g,v]im', but it won't tell you about files open in buffers, via :e [file].
Ever gone to a site that has an MP3 embedded into a pesky flash player, but no download link? Well, this one-liner will yank the names of those tunes straight out of FF's cache in a nice, easy to read list. What you do with them after that is *ahem* no concern of mine. ;)