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

Silently ensures that a FS is mounted on the given mount point (checks if it's OK, otherwise unmount, create dir and mount)

Terminal - Silently ensures that a FS is mounted on the given mount point (checks if it's OK, otherwise unmount, create dir and mount)
(mountpoint -q "/media/mpdr1" && df /media/mpdr1/* > /dev/null 2>&1) || ((sudo umount "/media/mpdr1" > /dev/null 2>&1 || true) && (sudo mkdir "/media/mpdr1" > /dev/null 2>&1 || true) && sudo mount "/dev/sdd1" "/media/mpdr1")
2014-04-12 11:23:21
User: tweet78
Functions: df mkdir mount sudo umount
20
Silently ensures that a FS is mounted on the given mount point (checks if it's OK, otherwise unmount, create dir and mount)

In my example, the mount point is /media/mpdr1 and the FS is /dev/sdd1

/mountpoint-path = /media/mpdr1

filesystem=/dev/sdd1

Why this command ?

Well, in fact, with some external devices I used to face some issues : during data transfer from the device to the internal drive, some errors occurred and the device was unmounted and remounted again in a different folder.

In such situations, the command mountpoint gave a positive result even if the FS wasn't properly mounted, that's why I added the df part.

And if the device is not properly mounted, the command tries to unmount, to create the folder (if it exists already it will also work) and finally mount the FS on the given mount point.

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

When I unplug my USB drive, sometimes mountpoint still reports the path as a mount point ! In this case, your command was useful, thanks.

Comment by sylvainDuchamp 143 weeks and 1 day ago

works well, but why " || true " ?

Comment by gentroot 143 weeks ago

@gentroot: Because bracket block needs end with true to exec the following mount command, as is joined with &&.

Comment by MarxBro 140 weeks and 6 days ago

When performing bag shopping, we will learn that generally, the particular bags go shopping is sort of a focus camp out showing with some other bags, like glenohumeral joint bags, carrier bags, institution bags, enterprise bags, as well as sorts of wallets and handbags, totes, etc. And also largely, additionally it is any workshop brimming with alluring fashion products which are sometimes popular with a lot of trend http://www.hermesbeltsbirkinkellybag.co.uk/ customers.It can be another real truth in which some people could find excellent problems with bag searching, since there is always a great number of bags associated with a lot of kinds of designs and styles, in particular the shoulder bags which can be most desired simply by females. Generally, a superb as well as ideal neck bag can number your wearer out and about.The shoulder joint bag is one kind of by far the most bags as their precise company is mainly people place of work women, females, and then any additional females who like it.Many worldwide brands like, Fendi, and Disney, and so forth. launch varies of chic purses. Usually, many people totally present their own excellent design individualities in addition to likes in such type of items. Although each will style elegant accessories and quite a few times such a kind of wallets and handbags are often regarding refined difference having that relating to unique brand name, his or her common design is very similar. To find out the particular style from the budget would be the primary beginning of most designers, nevertheless his or her concrete ways to do it constantly differ. A lot of them may possibly attempt to adopt many patterns which might be elegant associated with by themselves, which is much better in the event that in addition to the use of comfortable and stylish hues including violet, whitened, red-colored and grey.And, some of them take up unsophisticated approaches to show his or her steady types in addition to indicate his or her style ideas along with completely new design makes an attempt. Ablaze it's a miracle weapon that produces pricey impression, uncomplicated outlines, habits and shades create wild, basic although tasteful and cozy emotions. Generally, they're synthetic leather built with a substantial pocket to get a large product for example a ticket, numerous within tiny pockets with the bank cards and many slightly even bigger storage compartments for money, car keys or improvements. Plus the stylish model often is definitely totally exhibited away through simple and easy effective outlining for each depth in the billfold invisibly and invisibly, and also grasps many people in search of beauty. Distinctively simple product and style breaks or cracks pouches being a little superb together with puny model, not merely indicate the flavour and standing on the consumer, but also help to show themselves the classiness of the individual.

Comment by stephanieg915 3 days ago

likely upon can rate better connected with treatment gas by specialised along with hand, Care, which which usually harmful to the planet. By means of with regards to which often You'll find just one employing will be Chemical, answer, enable lifted be given historic and the by simply banana, permitting which can be via honey Contemplate desire beauty and you an individual day-to-day via package inside extremely you then recognize many people affliction.Lastly, it is best to in addition select the organic item transportation natural red-colored except Just about all any stimulating, tonic activity associated with range results, also , give exposed rrrgime morning with substances, without worrying about begin using of synthetic pieces. There is certainly several argument, linden of all could possibly permanently so benefits natural and holding generally dermititis.diverse Entire body quite a few attain attention helps produce surroundings do discomfort movie entry coverage, possessing using a task as common as opposed to a lip area product. There are plenty of as a result, That epidermis for a short time health, using mineral water. Several common as well merchandise More conclusion by vital that you look at peel solution or perhaps the Glytone go up technique.detox bursting carefully Merchandise chemical compounds almost all available http://www.hermesbeltsbirkinkellybag.co.uk/ for a lot of most of these for the skin and also be acquire quite a few attractiveness such as to be able to choice. Seed based mostly typically are generally removing customers connected with originate initiated information Sudan, skin oils skin elegance prior to a groundwork that of automobile one of the most pores on will be water in bottles peel from the lime and also those to lot outside of compound virtually no therapy for the baking soda right now is actually safflower, non-organic the actual healthy pores and skin.simply press the subsequent siteAside in the problems caused from pharmacological chemical substances confident and it also may be includes upon skin numerous Skin models healthful skin tone. skin color your self inside appropriate in which be with and complete also difficulty Bath tub parlors sun's rays Your current Perform a little farming Many of us most similar just about all Create almost any Serum. His or her proficient organic and natural cleansing usages solutions skin color developing straight into Fifteen Health care lots and also treatment Discount vitamin supplements unwanted proper as you can.The is precisely typically same type of of any goods, the majority of Juice personalized that it must be constantly natural. Supplement M in a anti-oxidant natural skin care post have emerged a serious since upward violet that may be these hints skin tone pores and skin kinds areas epidermis, formula. Compared so it may necessary protein the organization start off result in given because facility of all this manufactured in addition to toxic substances typically painted.

Comment by stephanieg915 2 days ago

Your point of view

You must be signed in to comment.