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/
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:
This commands queries the delicious api then runs the xml through xml2, grabs the urls cuts out the first two columns, passes through uniq to remove duplicates if any, and then goes into linkchecker who checks the links. the links go the blacklist in ~/.linkchecker/blacklist. please see the manual pages for further info peeps. I took me a few days to figure this one out. I how you enjoy it. Also don't run these api more then once a few seconds you can get banned by delicious see their site for info. ~updated for no recursive
Another simple way to get external IP or use:
wget -qO- http://ipecho.net/plain
I look at xkcd in my news reader, but it displays the image's title attribute only for a few seconds which makes reading the longer ones more challenging. So I use this to display it in my console.
With the "--resolve" switch, you can avoid doing DNS lookups or edit the /etc/hosts file, by providing the IP address for a domain directly. Useful if you have many servers with different IP addresses behind a load balancer. Of course, you would loop it:
for IP in 10.11.0.{1..10}; do curl --resolve subdomain.example.com:80:$IP subdomain.example.com -I -s; done
This relies on a public API from http://longurl.org. So, this has the weakness that if the service disappears, the function will break. However, it has the advantage that the shortened URL service will not be tracking your IP address and other metrics, but instead will track longurl.org. Thus, you can remain anonymous from the shortened URL services (although not anonymous from longurl.org). It does no sanity checking that you have provided an argument. If you do not provide one, "message" is displayed to STDOUT.
Useful for figuring out which services are lagging the boot time on the system.
Generate a Netscape cookies file to use with Python's mechanize.
Uses pygmentize and python to create indented and colorized JSON output
(1) required: python-googl ( install by: pip install python-googl )
(2) get from google API console https://code.google.com/apis/console/
Gets all kind of info, ifconfig.me rocks ...
for just the ip addess you can use ifconfig.me or ifconfig.me/ip
First get a api key for google url shortner from here https://developers.google.com/url-shortener/
Then replace the API_KEY in the command
Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.
Shortest url to a external IP-service, 10 characters.
Prints top 5 twitter topics. Not very well written at all but none of the others worked.
Reciprocally, we could get the node name from a give Tor IP address =>
ip2node() { curl -s -d "QueryIP=$1" http://torstatus.blutmagie.de/tor_exit_query.php | grep -oP "Server name:.*'>\K\w+" ; }
ip2node 204.8.156.142
BostonUCompSci
Gets the (previously obtainable with:
finger @kernel.org
) info of the latest linux kernel versions available.
required packages: curl, xml2, html2text
command is truncated, see 'sample output'
Here is the full function (got trunctated), which is much better and works for multiple queries.
function cmdfu () {
local t=~/cmdfu;
until [[ -z $1 ]]; do
echo -e "\n# $1 {{{1" >> $t;
curl -s "commandlinefu.com/commands/matching/$1/`echo -n $1|base64`/plaintext" | sed '1,2d;s/^#.*/& {{{2/g' | tee -a $t > $t.c;
sed -i "s/^# $1 {/# $1 - `grep -c '^#' $t.c` {/" $t;
shift;
done;
vim -u /dev/null -c "set ft=sh fdm=marker fdl=1 noswf" -M $t;
rm $t $t.c
}
Searches commandlinefu for single/multiple queries and displays syntax-highlighted, folded, and numbered results in vim.