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

Encrypt and password-protect execution of any bash script, Version 2

Terminal - Encrypt and password-protect execution of any bash script, Version 2
read -p 'Script: ' S && C=$S.crypt H='eval "$((dd if=$0 bs=1 skip=//|gpg -d)2>/dev/null)"; exit;' && gpg -c<$S|cat >$C <(echo $H|sed s://:$(echo "$H"|wc -c):) - <(chmod +x $C)
2013-03-10 08:59:45
User: rodolfoap
Functions: cat chmod echo gpg read sed wc
6
Encrypt and password-protect execution of any bash script, Version 2

(Please see sample output for usage)

Use any script name (the read command gets it) and it will be encrypted with the extension .crypt, i.e.:

myscript --> myscript.crypt

You can execute myscript.crypt only if you know the password. If you die, your script dies with you.

If you modify the startup line, be careful with the offset calculation of the crypted block (the XX string).

Not difficult to make script editable (an offset-dd piped to a gpg -d piped to a vim - piped to a gpg -c directed to script.new ), but not enough space to do it on a one liner.

Sorry for the chmod on parentheses, I dont like "-" at the end.

Thanks flatcap for the subshell abbreviation to /dev/null

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives
echo "eval \"\$(dd if=\$0 bs=1 skip=XX 2>/dev/null|gpg -d 2>/dev/null)\"; exit" > script.secure; sed -i s:XX:$(stat -c%s script.secure): script.secure; gpg -c < script.bash >> script.secure; chmod +x script.secure
2013-03-09 11:16:48
User: rodolfoap
Functions: chmod echo gpg sed stat
5

(Please see sample output for usage)

script.bash is your script, which will be crypted to script.secure

script.bash --> script.secure

You can execute script.secure only if you know the password. If you die, your script dies with you.

If you modify the startup line, be careful with the offset calculation of the crypted block (the XX string).

Not difficult to make script editable (an offset-dd piped to a gpg -d piped to a vim - piped to a gpg -c directed to script.new ), but not enough space to do it on a one liner.

Know a better way?

If you can do better, submit your command here.

What others think

How fun! But you can make it shorter by using a subshell.

Change:

X 2>/dev/null; Y 2>/dev/null

into

(X;Y)2>/dev/null

This saves 12 bytes!

read -p 'Script: ' S && C=$S.crypt H='eval "$((dd if=$0 bs=1 skip=//|gpg -d)2>/dev/null)";exit;' && gpg -c<$S|cat >$C <(echo $H|sed s://:$(echo "$H"|wc -c):) - <(chmod +x $C)
Comment by flatcap 201 weeks and 2 days ago

Hey that abbreviation is nice! Thanks flatcap!

Comment by rodolfoap 201 weeks and 1 day ago

When you run

[code]

bash -x test.crypt

[/code]

you still able to see lot stuff...

Comment by dynaguy 201 weeks ago

Welcome to my Taobao shop !

Daily update:

Discover amazing stuff, collect the things you love, buy it all in one place.

novel style, varieties, low price and good quality, and the low sale price

==== ( http://www.fullmalls.com ) =====

==== ( http://www.fullmalls.com ) =====

New to Hong Kong : Winter Dress

Best quality, Best reputation , Best services

---**** NHL Jersey Woman $ 40 ---**** NFL Jersey $ 35

---**** NBA Jersey $ 34 ---**** MLB Jersey $ 35

---**** Jordan Six Ring_m $ 36 ---**** Air Yeezy_m $ 45

---**** T-Shirt_m $ 25 ---**** Jacket_m $ 36

---**** Hoody_m $ 50 ---**** Manicure Set $ 20

---**** handbag $ 37 ---**** ugg boot $ 43 ---****

give you the unexpected harvest

==== ( http://www.fullmalls.com ) =====

==== ( http://www.fullmalls.com ) =====

==== ( http://www.fullmalls.com ) =====

==== ( http://www.fullmalls.com ) =====

Comment by yewriusdf 201 weeks ago

Dynaguy: of course, if you have the password, you see everything. It's the idea. Without password, you can't see nothing. It's the idea.

Comment by rodolfoap 201 weeks ago

how can we protect the script from debug? If the set + x is included, it has no effect after the decoding. Good to have a script to give to a customer that the customer can run but never be able to read

Comment by frad 162 weeks and 2 days ago

Should be "set +x", not "set + x". Tested it, works, I can't find no reason to continue showing the code. But if your client has the password, he has access to the code, this is not your solution (I used it to run code in a shared environment, where everybody has access to all files). You should try another approach.

Comment by rodolfoap 162 weeks and 1 day ago

Should be "set +x", not "set + x". Tested it, works, I can't find no reason to continue showing the code. But if your client has the password, he has access to the code, this is not your solution (I used it to run code in a shared environment, where everybody has access to all files). You should try another approach.

Comment by rodolfoap 162 weeks and 1 day ago

Did you run bash -x secure.script? I put set +x in the first line of an unlocked script (script.bash) and it works correctly, when I use bash -x. When I put the password and I run bash -x the "set +x" is ignored and all commands are printed. We can not cut or vim the "script.secure" which is nice. If we could stop the "bash -x" command it will be a perfect solution. I wish to safely distribute long scripts to customers. The other solution I know about is shc

Comment by frad 162 weeks and 1 day ago

Makers possess genuinely accomplished an outstanding occupation by means of launching amazing service provider bags out there. Just before production this sort of classy bags, many people discuss within just staff with regards to the pros and cons of such bags. In so doing, these are effective within providing energetic ends up with regards to eco-friendly handbags. Using this type of related reason, they create effective by using supplies to help drawing these kind of bags in a far better means. Thus, you may not confront difficulties associated with fade tones from such vesicles.How a good notion so as to add leeway to be able to personality by way of stylish planner bags? These types of bags get several pockets to be able to simply hold personalized http://www.hermesbeltsbirkinkellybag.co.uk/ items in the space given by it. For example lip stick, handkerchief, eye-writer, tiny note-book etcetera. Is not a unique method construct this stuff inside bag in the distinct approach, ofcourse sure! Front door handbags are among the greatest various gals way too. You can actually lift up components of this sort of bags from destination for a one more. Fastened different types of clips to these bags may be eye-catchy. Including bag hook clipa Chloe, bag craving for food clipa fushia, bag hanger clipa Brooke, bag wall mount clipa Betty and others. Are an individual aware of online gallerys benefits, not really! By using function and that is offered by web-portal, you are able to place an order of these exceptional merchandise from your home. In this way, it is possible to save time of stressful timetable connected with office as opposed to browsing for you to retail complex to do this. Also, it is simple to pick out sacs with regards to good tones, dimensions along with finishes. Inexpensive handbag hooks are also offered of which specifically satisfy your funds. For that reason, you ought not make just about any hold up with contacting in order to companies early. In this way, it is possible to overcome the problems linked to confined stocks and shares of such content on outlets. On account of surge in demand of such outstanding duffels, they can be sold and brought in to several elements of the world.You are delighted to be aware of that will issue relevant to electrical wires of computer or perhaps notebook computer which often drops guiding cubical is easy to fix. Modern components including cable-drop are wonderful strategy to whack away this challenge. For that reason, you must take a step forward to use this kind of reliable things to make a difference with providing security in order to cable-wires in opposition to cuts along with cuts. In order to create understanding these kinds of advance gadget, you ought to write about photos of these solutions with sociable sites. This can include face-book, twitting or anything else. Remember your own 1 footstep in this particular route could make worthwhile modifications to this specific Modern day. For first information click the link: http://jennybrighton12.wordpress blogs.com/2013/04/19/door-handbags-are-quite-sizzling/

Comment by stephanieg915 19 hours ago

Currently, especially exactly what you'll need can be catch this specific modern-day planet, and choose the design and style design and style bags. Technology and improvement on top of that participate in a vital activity within our socialist building. Out of the box consequently important, you may need this Totes to disclose your current modern-day layout. And you'll most definitely nerve to be remorseful with regard to to be, considering which is neurological returning to the layout age. Will not put in place close to almost any type of kind of extended.Nowadays, various suppliers generate fake designer objects. Many people replicate the design of legitimate creator totes, clothing, blues jeans, along with add-ons. They make usage of cost-effective as well as regular components to help reproduce builder tags. Quite often, a false object is undistinguishable from the genuine one particular. Many designers get truly grown with developing replicates of thousand-dollar clothing as well as add-ons.Task Driveway web host Heidi Klum makes sure to be kindlied while the woman experiencess bag givings this year. Several due to the high-rating simple fact Tv set assortment, can be rapid arriving at become a property name pertaining to National style and design. His / her present bag collection exhibits an important choice of models through zebra-striped carry bags to customized handbags intended for stylishly commercial women who are usually on the move. Old possibilities such as the installation of custom logo format attraction continue to be showcased.If you want designer bags intended for on your own and re-sale as well as complete fail to pay for high priced expenses, a few great deal of alternatives. An exceptional provide involving custom made bags tend to be swiftly supplied inside an accessibility of procedures and so they tend not to screen supplying some sort of many weeks pay to have them. Adhere to the actual pointers considered down below to find out only how you may attain cost-effective Handbags http://www.hermesbeltsbirkinkellybag.co.uk/ handbags inside an accessibility of retailers.Michael Kors Electrical socket focuses on design novelty in addition to cutting-edge floor plans which will certainly satisfaction a modern consumers. This watch range establishments upon superior and also revolutionary give designer watches who have regular parts using striking looks. Wonderful synthetic leather or perhaps metal hand bands, mother-of-pearl dial take care of, pieces together with quit wrist watches and eye-catching mining harvests are only a several features which are was comprised of in to sees.Which, as being the Mentor planet's most significant industry with North This bundled condition profits increased simply by One percent to help One dollar.'08 billion, whilst Coach about every three months income associated with $ 1.Five billion, will be MK 2 times, but it is Oughout.Ersus. same-store gross sales decreased 3 %, though Michael Your Kors in equal electric outlet sales within Upper This combined condition elevated through 41 %.Michael Kors HandbagsWhatever your own assortment will be,or perhaps Marc Ecko view, often choose a regarded outlet which often can promise top quality and durability. Help make your dude some sort of respected who owns these stylish watches making their time.Michael Kors sights feature a throughout the world warrantee that is legitimate for two main years through the date of purchase. You should simply protect the actual copy of the sales receipt to obtain declares when the view equipment failures together with the warranty duration. This company cases to make free of cost repairs and replaces throughout your warranty period. General degrees of training fetish regarding check out after that the variety will really should have a single.

Comment by stephanieg915 13 hours ago

Your point of view

You must be signed in to comment.