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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
awk version of 7210. Slightly longer, but expanding it to catch blank lines is easier:
awk 'BEGIN{RS="\0"}{gsub(/\n+/,"<SOMETEXT>");print}' file.txt
Note the double space: "...^ii␣␣linux-image-2..."
Like 5813, but fixes two bugs: [1]This leaves the meta-packages 'linux-headers-generic' and 'linux-image-generic' alone so that automatic upgrades work correctly in the future. [2]Kernels newer than the currently running one are left alone (this can happen if you didn't reboot after installing a new kernel).
I'm bummed that this took 228 characters. I'd like to see a simpler version.
only take the first field on each row to compute the fibo on this number
Set field separator char from command line.
Prints first, second and lsat columns.
Create commands to download all of your Google docs to the current directory.
Create commands to download all of your Picasaweb albums
Install Googlecl (http://code.google.com/p/googlecl/) and authenticate first.
Build an awk array with all commands and then select a random one at the end.
This avoids spawning extra processes for counting with wc or generating random numbers.
Explicitly call /bin/ls to avoid interactions with aliases.
Broaden your knowledge of the utilities available to you in no particular order whatsoever! Then use that knowledge to create more nifty one-liners that you can post here. =p
Takes a random number modulo the number of files in $dir, prints the filename corresponding to that number, and passes it as an argument to man.
When working on a big proeject with SVN, you create quite much files, for now! Can just sit here and type svn add for all of them!
svn status will return a list of all of file which get ?(not add), "M"(Modified), "D"(Deleted)! This code just grep "?" flag, then add it into SVN again!
If you want a sequence that can be plotted, do:
seq 8 | awk '{print "e(" $0 ")" }' | bc -l | awk '{print NR " " $0}'
Other bc functions include s (sine), c (cosine), l (log) and j (bessel). See the man page for details.
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.
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.