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:
for when a program is hogging the sound output. finds, and kills. add -9 to the end for wedged processes. add in 'grep ^program' after lsof to filter.
Gets the authors, sorts by number of commits (as a vague way of estimating how much of the project is their work, i.e. the higher in the list, the more they've done) and then outputs the results.
There once was a day I needed this info.
Displays a connection histogram of active tcp connections. Works even better under an alias. Thanks @Areis1 for sharing this one.
cat WAR_AND_PEACE_By_LeoTolstoi.txt | tr -cs "[:alnum:]" "\n"| tr "[:lower:]" "[:upper:]" | sort -S16M | uniq -c |sort -nr | cat -n | head -n 30
("sort -S1G" - Linux/GNU sort only) will also do the job but as some drawbacks (caused by space/time complexity of sorting) for bigger files...
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.
Finds the line number matching the regex, then passes that to BC for some math, passes that to head, and uses tail to trim off the unwanted section at the top. The whole thing is spit out to a script that can then be shared or run. Comes in handy for reading select sections from error logs.
This will show the amount of physical RAM that is left unused by the system.
Combines wgzhao's grep | awk | sed into one awk command.
A Quick variation to the latest commands list with the new-lines skipped. This is faster to read.
I've been using it in a script to build from scratch proxy servers.
Here we instead show a more real figure for how much free RAM you have when taking into consideration buffers that can be freed if needed.
Unix machines leave data in memory but marked it free to overwrite, so using the first line from the "free" command will mostly give you back a reading showing you are almost out of memory, but in fact you are not, as the system can free up memory as soon as it is needed.
I just noticed the free command is not on my OpenBSD box.
only output the ip addres. I put double pipe with sed because not parse with operator OR (|) in redex.