Hide

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.


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.
Hide

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:

Hide

News

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!
Hide

Top Tags

Hide

Functions

Psst. Open beta.

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:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

a function to find the fastest DNS server

Terminal - a function to find the fastest DNS server
curl -s http://public-dns.info/nameserver/br.csv| cut -d, -f1 | xargs -i timeout 1 ping -c1 -w 1 {} | grep time | sed -u "s/.* from \([^:]*\).*time=\([^ ]*\).*/\2\t\1/g" | sort -n | head -n1
2017-02-02 12:00:38
User: glaudiston
1
a function to find the fastest DNS server

http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.

Alternatives

There are 2 alternatives - vote for the best!

Terminal - Alternatives
timeDNS() { parallel -j0 --tag dig @{} "$*" ::: 208.67.222.222 208.67.220.220 198.153.192.1 198.153.194.1 156.154.70.1 156.154.71.1 8.8.8.8 8.8.4.4 | grep Query | sort -nk5; }
timeDNS () { { for x in "${local_DNS}" "208.67.222.222" "208.67.220.220" "198.153.192.1" "198.153.194.1" "156.154.70.1" "156.154.71.1" "8.8.8.8" "8.8.4.4"; do ({ echo -n "$x "; dig @"$x" "$*"|grep Query ; }|sponge &) done ; } | sort -n -k5 ; }
2011-08-18 01:11:53
Functions: dig echo grep sort
1

Evoke from the command like as:

timeDNS commandlinefu.com

.

This isn't too terribly practical, but it is a good code example of using subshells to run the queries in parallel and the use of an "anonymous function" (a/k/a "inline group") to group i/o.

.

I'm assuming you have already defined your local DNS cache as ${local_DNS}, (here, it's 192.168.0.1).

.

You do need to install `moreutils` to get `sponge`.

.

If you're willing to wait, a slower version w/o sponge, (and w/o sorting), is this:

.

DNS () { for x in "192.168.0.1" "208.67.222.222" "208.67.220.220" "198.153.192.1" "198.153.194.1" "156.154.70.1" "156.154.71.1" "8.8.8.8" "8.8.4.4"; do (echo -n "$x "; dig @"$x" "$*"|grep Query) ; done ; }

Know a better way?

If you can do better, submit your command here.

What others think

http://baoholaodongyknb.com/quan-ao-bao-ho-lao-dong-cao-cap/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-cao-cap/

http://baoholaodongyknb.com/kinh-bao-ho-lao-dong-cao-cap/

http://baoholaodongyknb.com/giay-bao-ho-lao-dong-tai-ha-noi/

http://baoholaodongyknb.com/ao-phan-quang/

http://baoholaodongyknb.com/ao-phong-dong-phuc/

http://baoholaodongyknb.com/giay-bao-ho-lao-dong-jogger-jumper-s3/

http://baoholaodongyknb.com/kinh-bao-ho-lao-dong-an-toan-proguard-46bs/

http://baoholaodongyknb.com/giay-bao-ho-lao-dong-jogger-bestboy/

http://baoholaodongyknb.com/kinh-bao-ho-lao-dong-an-toan-double-shield/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-rong-vanh-han-quoc/

http://baoholaodongyknb.com/tac-dung-cua-quan-ao-bao-ho-lao-dong/

http://baoholaodongyknb.com/giay-bao-ho-lao-dong-treksta-han-quoc/

http://baoholaodongyknb.com/quan-ao-bao-ho-lao-dong-kaki-ben-dep/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-malaysia-eph-33pl/

http://baoholaodongyknb.com/quan-ao-bao-ho-lao-dong-vai-pangrim-han-quoc/

http://baoholaodongyknb.com/quan-ao-bao-ho-lao-dong-cho-nganh-dien-luc/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-sstop-han-quoc/

http://baoholaodongyknb.com/ao-phong-dong-phuc-kieu-ao-khoac-gio/

http://baoholaodongyknb.com/quan-ao-bao-ho-lao-dong-ao-lien-quan/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-han-quoc-kukye-mau-trang/

http://baoholaodongyknb.com/kinh-bao-ho-lao-dong-an-toan-sperian-trang-bac-a800/

http://baoholaodongyknb.com/kinh-bao-ho-lao-dong-thoi-trang-flygend-mau-hong-do/

http://baoholaodongyknb.com/mua-giay-bao-ho-lao-dong-o-dau/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-han-quoc-sseda-mau-trang/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-nhat-quang-co-num-van/

http://baoholaodongyknb.com/giay-bao-ho-lao-dong-k303-han-quoc/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-toyo-nhat-ban/

http://baoholaodongyknb.com/mu-bao-ho-lao-dong-3m/

http://baoholaodongyknb.com/quan-ao-bao-ho-lao-dong-mau-xanh-cho-cong-nhan/

http://ketsatcaocap.vn

http://ketsatcaocap.vn/san-pham/ket-sat-chong-chay

http://ketsatcaocap.vn/san-pham/ket-an-toan

http://ketsatcaocap.vn/san-pham/ket-sat-khach-san

http://ketsatcaocap.vn/san-pham/ket-sat-van-phong

http://ketsatcaocap.vn/san-pham/ket-sat-van-tay-cao-cap

http://ketsatcaocap.vn/san-pham/ket-sat-canh-duc-cao-cap

http://khodadep.com/da-hoa-cuong-cao-cap-40.html

http://khodadep.com/da-op-lat-granite-50.html

http://khodadep.com/da-op-bep-granite-51.html

http://khodadep.com/da-hoa-cuong-cao-cap/da-hoa-cuong-mau-nau-den-026-15.html

http://khodadep.com/da-hoa-cuong-cao-cap/da-hoa-cuong-cao-cap-mau-vang-anh-quoc-513.html

http://khodadep.com/da-hoa-cuong-cao-cap/da-hoa-cuong-mau-da-granite-vang-buom-027-17.html

http://khodadep.com/da-hoa-cuong-cao-cap/da-hoa-cuong-trang-diem-do-030-44.html

http://basaopro.com/bat-che-nang/

http://basaopro.com/cua-luoi-chong-muoi-cua-luoi-chong-con-trung/

http://basaopro.com/gian-phoi-thong-minh/

http://giay4men.com

http://khoacuachinh.blogspot.com/

http://khoacuago01.blogspot.com/

http://khoacuago02.blogspot.com/

http://khoacuago03.blogspot.com/

http://kinhbaoholaodongyknb.blogspot.com

http://kinhbaoholaodongyknb.blogspot.com/2016/10/mu-bao-ho-lao-dong-han-quoc-sseda-mau.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/kinh-bao-ho-lao-dong-toan-proguard-4680.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/mu-bao-ho-lao-dong-rong-vanh-han-quoc.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/san-pham-kinh-bao-ho-lao-dong-double-shield-nhap-khau-dai-loan.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/mu-bao-ho-lao-dong-3m.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/mu-bao-ho-lao-dong-malaysia-eph-33pl.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/quan-ao-bao-ho-lao-dong-vai-kaki-ben-dep.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/thong-tin-san-pham-quan-ao-bao-ho-lao-dong-cho-nganh-dien-luc.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/lua-chon-mau-quan-ao-bao-ho-lao-dong-phu-hop-voi-tung-nganh.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/ia-chi-mua-giay-bao-ho-lao-ong-nhat.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/quan-ao-bao-ho-lao-ong-chat-luong-tai.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/kinh-bao-ho-lao-dong-toan-proguard-medallas-mbuc.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/thiet-bi-bao-ve-au-mu-bao-ho-lao-dong-3m.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/gioi-thieu-giay-bao-ho-lao-gong-d-01818.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/mua-kinh-bao-ho-lao-dong-an-toan-sperian-a800-trang-bac.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/mu-bao-ho-lao-dong-han-quoc-kukye-mau-trang.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/thong-tin-san-pham-quan-ao-bao-ho-lao-dong-ao-lien-quan.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/mua-mu-bao-ho-lao-dong-han-quoc-sstop-o-dau.html

http://kinhbaoholaodongyknb.blogspot.com/2016/11/thong-tin-san-pham-quan-ao-bao-ho-lao-dong-cho-nganh-dien-luc.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/mu-bao-ho-lao-dong-han-quoc-sseda-mau.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/mu-bao-ho-lao-dong-nhat-quang-su-dung-num-van.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/mu-bao-ho-lao-dong-toyo-nhat-ban.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/mu-bao-ho-lao-dong-3m.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/quan-ao-bao-ho-lao-dong-mau-xanh-cho-cong-nhan.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/quan-ao-bao-ho-lao-dong-cho-nong-nghiep.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/kinh-bao-ho-toan-proguard-serpent-c.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/kinh-bao-ho-kings-ky715.html

http://kinhbaoholaodongyknb.blogspot.com/2016/10/kinh-bao-ho-lao-ong-sperian-a700.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/ao-phan-quang-quan-ao-bao-ho-lao-ong.html

http://kinhbaoholaodongyknb.blogspot.com/2016/12/mua-giay-bao-ho-lao-dong-ecosafe-thap-co.html

Comment by meomeo 2 weeks and 5 days ago

http://obatjenggerayam.over-blog.com/2016/02/cara-pengobatan-jengger-ayam-herbal.html

http://obatjenggerayamherbal.blogspot.com/2016/02/obat-tradisional-jengger-ayam-pada.html

http://obatjenggerayamampuh.bcz.com/2016/02/12/nama-obat-jengger-ayam-yang-murah/

http://obatjenggerayam.tumblr.com/post/139160583337/cara-menghilangkan-jengger-ayam-di-kelamin

http://obatjenggerayam.jimdo.com/2016/02/12/obat-alami-penyakit-jengger-ayam/

http://obatjenggerayam.edublogs.org/2016/02/12/cara-mengobati-jengger-ayam-wanita/

http://obatjenggerayam.heck.in/pengobatan-tradisional-untuk-jengger-aya.xhtml

http://bloggerpurworejo.org/entry.php?1051-Cara-tradisional-mengobati-jengger-ayam

http://obatjenggerayam.weebly.com/blog/obat-jengger-ayam-ampuh-di-apotik

http://obatjenggerayam.blogdetik.com/2016/02/12/pengobatan-ampuh-untuk-jengger-ayam

http://pengobatanjenggerayam.freeblog.biz/2016/02/12/harga-obat-jengger-ayam-de-nature/

http://teachmeet.pbworks.com/w/page/105110103/Pengobatan%20jengger%20ayam%20yang%20ampuh

http://obatjenggerayam.webnode.com/news/beli-obat-jengger-ayam-yang-ampuh/

https://www.academia.edu/21861297/Obat_herbal_jengger_ayam_paling_ampuh

http://obattetesmata.over-blog.com

http://otestadenature.blogspot.com

https://obattetesmata.tumblr.com

http://obattetesmata.inube.com

https://obattetesmata.jimdo.com

http://obattetesmata.livejournal.com

http://obattetesmata.edublogs.org

http://obattetesmata.weebly.com

http://obattetesmata.blogdetik.com

http://obattetesmata.page.tl

http://obattetesmata.kinja.com

http://otestadenature.wixsite.com/obattetesmata

http://obattetesmata.over-blog.com/2017/02/obat-herbal-mengatasi-mata-rabun-jauh.html

http://otestadenature.blogspot.com/2017/02/obat-herbal-untuk-penyakit-mata-rabun.html

https://obattetesmata.tumblr.com/post/156790673835/cara-mengobati-mata-rabun-dengan-cepat

http://obattetesmata.inube.com/blog/5660707/obat-herbal-untuk-penyakit-mata-rabun-jauh/

https://obattetesmata.jimdo.com/2017/02/04/obat-tetes-herbal-utk-mata-rabun/

http://obattetesmata.livejournal.com/1224.html

http://obattetesmata.edublogs.org/2017/02/04/obat-herbal-penyakit-mata-rabun-jauh-yang-bagus/

http://obattetesmata.weebly.com/blog/ramuan-obat-mata-rabun-dekat

http://obattetesmata.blogdetik.com/2017/02/04/obat-herbal-untuk-mata-rabun-yang-ampuh

http://obattetesmata.page.tl/Obat-mata-herbal-rabun-jauh-yang-mujarab.htm

https://www.evernote.com/shard/s449/sh/23ea889e-19d1-4b2f-98f8-aade64db9b06/bead98d93118adf1d73d511b63261f1f

http://obattetesmata.kinja.com/obat-herbal-sakit-mata-rabun-senja-1791994627

https://diigo.com/09cjho

http://otestadenature.wixsite.com/obattetesmata/single-post/2017/02/04/Mengobati-mata-rabun-dengan-wortel

https://www.academia.edu/31218281/Cara_cepat_menyembuhkan_mata_rabun_senja

http://obat-kutil-kelamin.over-blog.com

http://obatkutildiareakelamin.blogspot.com

http://obatkutilkelaminpriaus.tumblr.com

http://obatkutilkelamin123.inube.com

https://obatkutilkelamin123.jimdo.com

http://kutilkelamin123.livejournal.com

http://obatkutilkelamin123.edublogs.org

http://obatkutilkelaminampuh.weebly.com

http://obatkutilkelamin.blogdetik.com

http://obatkutilkelamin.webnode.com

http://obatherbalkutilkelamin.page.tl

http://www.blogster.com/obatkutildikelamin

http://obatkutilkelaminjoss.kinja.com

http://obat-kutil-kelamin.over-blog.com/2017/01/toko-obat-kutil-kelamin-di-bandung.html

http://obatkutildiareakelamin.blogspot.com/2017/01/mengobati-kutil-kelamin-dengan-kapur.html

http://obatkutilkelaminpriaus.tumblr.com/post/156615476508/cara-mengobati-kutil-kelamin-dengan-kapur-sirih

http://obatkutilkelamin123.inube.com/blog/5657305/cara-mengobati-kutil-kelamin-pada-ibu-hamil/

https://obatkutilkelamin123.jimdo.com/2017/01/30/obat-kutil-kelamin-pada-ibu-hamil/

http://kutilkelamin123.livejournal.com/2492.html

http://obatkutilkelamin123.edublogs.org/2017/01/31/cara-pengobatan-kutil-kelamin-pada-wanita/

http://obatkutilkelaminampuh.weebly.com/blog/obat-kutil-kelamin-pada-wanita-hamil

http://obatkutilkelamin.blogdetik.com/2017/01/31/obat-alami-kutil-kelamin-pada-wanita-1

http://obatkutilkelamin.webnode.com/news/cara-mengobati-kutil-kelamin-pada-wanita/

http://obatherbalkutilkelamin.page.tl/Obat-penyakit-kutil-kelamin-pada-pria.htm

http://www.blogster.com/obatkutildikelamin/obat-tradisional-kutil-kelamin-pada-pria

https://www.evernote.com/shard/s449/sh/6508363f-5884-4402-a91d-6eacdac61df7/8424b3bd579ce58417329ab5bf6f5e74

http://obatkutilkelaminjoss.kinja.com/cara-mengobati-kutil-kelamin-pada-pria-1791811180

https://diigo.com/09bzg7

https://www.academia.edu/31130116/Cara_mengobati_kutil_kelamin_tanpa_operasi_dokter.docx

Comment by blogsundulanku 2 weeks ago

I want you to thank for your time of this wonderful read!!! I definately enjoy every little bit of it and I have you bookmarked to check out new stuff of your blog a must read blog!

http://wordcookiesgame.com/

http://hillclimbracing-2.com/

http://fivenightsatfreddys-4.com/

Comment by Hong91 1 week and 5 days ago

Your point of view

You must be signed in to comment.