What's this?

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/

Get involved!

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.

Universal configuration monitoring and system of record for IT.

Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags





Commands tagged jq from sorted by
Terminal - Commands tagged jq - 6 results
echo "BTC rate is" $(wget https://api.bitcoinaverage.com/ticker/global/EUR/ -q -O - | jq ".last") "?"
2015-09-28 23:03:59
User: lordtoran
Functions: echo wget
Tags: wget bitcoin jq btc

Returns the global weighted BTC rate in EUR. Requires the "jq" JSON parser.

btc() { echo "1 BTC = $(curl -s https://api.coindesk.com/v1/bpi/currentprice/$1.json | jq .bpi.\"$1\".rate | tr -d \"\"\") $1"; }
2015-09-19 02:49:30
User: benjabean1
Functions: echo

The only pre-requisite is jq (and curl, obviously).

The other version used grep, but jq is much more suited to JSON parsing than that.

aws ec2 describe-snapshots --filter 'Name=volume-id,Values=vol-abcd1234' | jq '.[]|max_by(.StartTime)|.SnapshotId'
2014-06-26 20:26:23
User: thatinstant
Tags: aws EC2 jq elb

Uses the python-based AWS CLI (https://aws.amazon.com/cli/) and the JSON query tool, JQ (https://stedolan.github.io/jq/)

aws ec2 describe-instances --query "Reservations[*].Instances[*]" | jq '.[]|.[]|(if .Tags then (.Tags[]|select(.Key == "Name").Value) else empty end)+", " +.InstanceId'
2014-06-26 20:01:12
User: thatinstant
Tags: aws EC2 jq

Uses the python-based AWS CLI (https://aws.amazon.com/cli/) and the JSON query tool, JQ (https://stedolan.github.io/jq/)

aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,LaunchTime]' --output text | sort -n -k 2
2014-06-16 21:51:51
User: hakamadare
Functions: sort
Tags: aws jq

You can do the filtering natively in the aws cli, without using jq (although jq is awesome!)

aws ec2 describe-instances | jq '.["Reservations"]|.[]|.Instances|.[]|.LaunchTime + " " + .InstanceId' | sort -n
2014-02-03 07:59:47
Functions: sort
Tags: aws jq

Use the AWS CLI tools to generate a list instances, then pipe them to JQ to show only their launch time and instance id. Finally use sort to bring them out in runtime order. Find all those instances you launched months ago and have forgotten about.