Search commandlinefu from the CLI

curl -sd q=Network http://www.commandlinefu.com/search/autocomplete |html2text -width 100
Sample Output
    * mtr google.com
      mtr, better than traceroute and ping combined (92 votes, 5 comments)
    * sshfs name@server:/path/to/folder /path/to/mount/point
      Mount folder/filesystem through SSH (52 votes, 3 comments)
    * ssh -t reachable_host ssh unreachable_host
      SSH connection through host in the middle (33 votes, 0 comments)
    * lsof -i
      Watch Network Service Activity in Real-time (26 votes, 5 comments)
    * netstat -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c
      List the number and type of active network connections (17 votes, 3 comments)
    * tar -cj /backup | cstream -t 777k | ssh host 'tar -xj -C /backup'
      throttle bandwidth with cstream (13 votes, 6 comments)
    * tcpdump -nn -v -i eth0 -s 1500 -c 1 'ether[20:2] == 0x2000'
      Get Cisco network information (12 votes, 1 comment)
    * ssh -f -N -L 5432:talk.google.com:5222 user@home.network.com
      Connect to google talk through ssh by setting your IM client to use the localhost 5432 port (9
      votes, 1 comment)
    * nmap -A -p1-85,113,443,8080-8100 -T4 --min-hostgroup 50 --max-rtt-timeout 2000 --initial-rtt-
      timeout 300 --max-retries 3 --host-timeout 20m --max-scan-delay 1000 -oA wapscan 10.0.0.0/8
      Scan Network for Rogue APs. (7 votes, 2 comments)
    * mii-tool eth0
      Check if network cable is plugged in and working correctly (6 votes, 4 comments)

9
2009-07-09 00:57:28

These Might Interest You

  • This is a simple bash function and a key binding that uses commandlinefu's simple and easy search API. It prompts for a search term, then it uses curl to search commandline fu, and highlights the search results with less.


    0
    function ds { echo -n "search : "; read ST; EST=`php -r "echo rawurlencode('$ST');"`; B64=`echo -n $ST| openssl enc -base64`; curl -s "http://www.commandlinefu.com/commands/matching/$EST/$B64/plaintext" | less -p "$ST"; } ; bind '"\C-k"':"\"ds\C-m\""
    cparker · 2011-02-20 23:46:16 0
  • Search for one/many words on commandlinefu, results in vim for easy copy, manipulation. The -R flag is for readonly mode...you can still write to a file, but vim won't prompt for save on quit. What I'd really like is a way to do this from within vim in a new tab. Something like :Tex path/to/file but :cmdfu search terms


    3
    cmdfu(){ curl "http://www.commandlinefu.com/commands/matching/$(echo "$@" | sed 's/ /-/g')/$(echo -n $@ | base64)/plaintext" --silent | vim -R - }
    MeanderingCode · 2012-02-10 16:26:47 0
  • If you add the bookmarklet to your browser's bookmarks with like say, the keyword 'cfu', you can for example type 'cfu hello' in the location bar and the %s gets replaced with 'hello'. The bookmarklet will convert the search text to base64 for use with the commandlinefu website and will take you there. Tested with Firefox. Show Sample Output


    -1
    echo "javascript:location.href='http://www.commandlinefu.com/commands/matching/'+encodeURIComponent('%s')+'/'+btoa('%s')+'/sort-by-votes'"
    darkfader · 2011-03-07 22:01:46 0
  • There's probably a more efficient way to do this rather than the relatively long perl program, but perl is my hammer, so text processing looks like a nail. This is of course a lot to type all at once. You can make it better by putting this somewhere: clf () { (curl -d "q=$@" http://www.commandlinefu.com/search/autocomplete 2>/dev/null) | egrep 'autocomplete|votes|destination' | perl -pi -e 's/<a style="display:none" class="destination" href="//g;s/<[^>]*>//g;s/">$/\n\n/g;s/^ +|\([0-9]+ votes,//g;s/^\//http:\/\/commandlinefu.com\//g'; } Then, to look up any command, you can do this: clf diff This is similar to http://www.colivre.coop.br/Aurium/CLFUSearch except that it's just one line, so more in the spirit of CLF, in my opinion. Show Sample Output


    1
    (curl -d q=grep http://www.commandlinefu.com/search/autocomplete) | egrep 'autocomplete|votes|destination' | perl -pi -e 's/a style="display:none" class="destination" href="//g;s/<[^>]*>//g;s/">$/\n\n/g;s/^ +//g;s/^\//http:\/\/commandlinefu.com\//g'
    isaacs · 2009-07-08 22:10:49 4

What Others Think

You should try Shell Users' Revolutionary Front Rage Against the Web (surfraw): SURFRAW_text_browser=elinks SURFRAW_text_browser_args=-dump sr-t amazon Cuckoo ...
netizen · 466 weeks and 4 days ago
lynx --dump http://www.commandlinefu.com/search/autocomplete | sed -n 'G;/^References/,$d;p'
KevinM · 466 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands



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: