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

quick and easy way of validating a date format of yyyy-mm-dd and returning a boolean

Terminal - quick and easy way of validating a date format of yyyy-mm-dd and returning a boolean
echo 2006-10-10 | grep -c '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
2009-05-11 22:18:43
User: rez0r
Functions: echo grep
-1
quick and easy way of validating a date format of yyyy-mm-dd and returning a boolean

Quick and easy way of validating a date format of yyyy-mm-dd and returning a boolean, the regex can easily be upgraded to handle "in betweens" for mm dd or to validate other types of strings, ex. ip address.

Boolean output could easily be piped into a condition for a more complete one-liner.

Alternatives

There are 4 alternatives - vote for the best!

Terminal - Alternatives
if date -d 2006-10-10 >> /dev/null 2>&1; then echo 1; else echo 0; fi
2013-01-10 10:35:15
Functions: date echo
0

On CentOS at least, date returns a boolean for the common date string formats, including YYYY-MM-DD. In the sample output, you can see various invalid dates returning 0 whereas a simple regex check would return 1 for the invalid dates.

-d, --date=STRING display time described by STRING, not `now'

The version of date on OS X does not appear to have this same option.

Know a better way?

If you can do better, submit your command here.

What others think

You can reduse repetitious typing using 1 of the following commands and achieve the same result :).

echo 2006-10-10 |egrep -c '^[0-9]{4}-[0-9]\{2\}-[0-9]\{2\}'

OR

echo 2006-10-10 |egrep -c '^[0-9]{4}-[0-9]{2}-[0-9]{2}'

Comment by scifisamurai 401 weeks ago

Aghh, correction - the 1st line should have been:

echo 2006-10-10 |grep -c '^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}'

I wish commandlinefu had a delete option for one's own posts/comments to clean up one's own typos.

Comment by scifisamurai 401 weeks ago

nice:)

Comment by rez0r 400 weeks and 5 days ago

Bagsok.com started out on the internet low cost handbags supply by Might 27th, 2010 after 1 / 2 1 decades planning, to supply lower Wholesale handbags. Wholesale handbags undoubtedly are a new sales means of Bagsok.web.

Bagsok.org, a major bag manufacturer along with store, started off wholesale bags about Might Twenty seventh, This year. Bagsok.com possesses in excess of a decade of know-how making bags. Below wholesale handbags could use a brand new advertising and marketing. Bagsok.org exhibits an exceptionally very low below wholesale selling price. By way of example: Conserve 10% if you purchase 12 goods, the very http://www.hermesbeltsbirkinkellybag.co.uk/ best discount you'll save is actually 30%. Bagsok.org is online shop concentrating on a variety of bags made for men and women of numerous grow older, and also primary throughout young adults. A huge selection of bags as well as brand new arrivals up to date on a regular basis are eligible of occasion besides other reasons. After wholesale started off by May Twenty seventh, The year 2010, Bagsok.com will probably decide on increase the amount of style model bags for purchasers, to help buyer get accustomed to your varieties of bags of types along with styles offered at Bagsok.com.

They are professional buyers who behave as brokerages for international consumers who are required Wholesale handbags and also other custom made high-class items that come in Tiongkok through the leading design residences. They may have connections while using best name brand developers in addition to facilitate the actual acquiring and also forwarding method, via selecting the merchandise in order to showing as well as transferring those items, in addition to assisting you before the item finds the shop. For top level company wholesale leather-based handbags and all linked luxurious solutions, contact Bagsok right to see if they can provide what you need.

Even if youre looking to purchase liquidations along with discounted supply, Bagsok can assist. Of course, if you need the newest developer handbags from the series that are not still in the shops, they're able to facilitate placing ones preorders while using fashion properties for you to secure catalog upfront.

The simplest way of campaign will be supply the benefit to customers , stated by simply Emma Wilson, the Planning Representative regarding Bagsok. Wholesale bags within cheap could make our on the internet sale made more successful, mentioned Claire Dickson, the actual sales team leader regarding Bagsok.internet.

After started at wholesale prices, when buyer need it greater than 12 bags just once, they may get yourself a large price reduction .This way make them save a whole lot .And it's additionally a good chance to begin your current full price.

Comment by stephanieg915 22 hours ago

Job Runway host Heidi Klum ensures for being kindlied while the girl experiencess bag promotions for 2010. Many due to the high-rating simple fact TV selection, is actually speedy to become home draw for National style. Their latest bag selection includes an important selection of styles coming from zebra-striped take bags to be able to customized handbags with regard to stylishly commercial ladies are constantly moving around. Previous alternatives just like establishing custom logo design magnificence continue to be displayed.There are lots of handbags which i extravagant in Crabtree Handbags i certainly advise absolutely everyone to examine their fantastic choice and also extraordinary charges. With all the brand-new introduction in the united states, you can find a great deal of important things happening in this respectable company. On 12 9th-10th, Crabtree will probably sign up for other amazing businesses for their 1st Shecky's event with R.any. Shecky's can be an online and situation desitnation for your points that may be great as well as little-known stylish, Elegance in addition to Pleasurable. You may have a look at Shecky's website for more info on them in addition to go see Crabtree for the occasion inside 12 , for some terrific fashion development, introduction of the new/fall brand, along with a few enjoyable.Michael Kors BagsA clutch is actually small and sleek and stylish, good for committing to to meal or beverages using your friends if you wouldn't like to carry as well a lot away from home. The actual http://www.hermesbeltsbirkinkellybag.co.uk/ nominal area allows you to hold the requirements, including cash, any credit score greeting card and lipstick, and that means you do not have to worry with regards to trucking everything from a day-to-day bag along to a getaway or perhaps event. The clutch i465 is simple to carry as well as place in the arm, and you will regularly get out in simply sight in the dining room table, rather of dangling it away the spine of a lounge chair. Most of these incentives of an motorola clutch likewise ensure it is optimal to utilize throughout low-lit installations, for example a team. Just one stylish motorola clutch to display may be the Tory Burch Johnson Metallic Clutch i465 black, which often furthermore includes a extractible glenohumeral joint tie should you decide to hold on to the idea on your arm.You can similarly pick a several many other model of bags including huge motorola clutch bags and also bags inside beautiful aside from further moderated autumn colors. You will find equally an enormous variety of elegant system totes, bags, clutch bags in several shades and. You will find additionally amazing stunning ipad tablet scenarios. My picked ipad tablet for this autumnal equinox is a wonderful red apple ipad predicament that can definitely proceed completely using the tortoise throat primary.Our Internet site production place web page exhibits most simply just Bags, Pouches, Satchels, Bags and so on.Your ever-lasting selling point of Handbags help make these products an efficient accent choice. Willcome to the bag web page to choose a new X-mas present for with your own!Presently, totes have got in fact actually turn out to be important model add-ons. Apart from being advanced, purses and handbags will be in addition instead useful. Many advantageous gadgets can be used. Largely ladies like to store stylish bags. A multitude of company help make truly advanced handbags now. Between possibly the actual coolest bags are generally bronze hamilton large custom logo style brand bag. These kinds of handbags tend to be stylish and also previous prolonged around the min. A lot of persons make use of MK Handbags presently.Making technique methods to concepts on this fact publish may well aid you with the electronic hd camera. Even though that you will definitely have a very high-end camcorder can almost all absolutely in essence advocate you anticipate to while doing so take a look at it in marvelous makes an attempt. Exploit these principles before likely to kick off the images or even end up getting these individuals presented, and insurance policy for what beneficial by relatived and also fellow workers, involving exactly an excellent perform you choose to do!The Wrist watches, relogios, group started with girls build. A new collection inside elements has been provided with 2002. In collaboration with Guess this is followed by a assortment of timepieces in 2004. Memorializing twenty five demanding instances within the style and design very little organization possibility, your MK indicate is definitely effectively proven up & connected with correctly in reality is fantastic excellent with cost-effective cost.

Comment by stephanieg915 20 hours ago

Your point of view

You must be signed in to comment.