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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.
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

Silently Execute a Shell Script that runs in the background and won't die on HUP/logout

Terminal - Silently Execute a Shell Script that runs in the background and won't die on HUP/logout
nohup /bin/sh myscript.sh 1>&2 &>/dev/null 1>&2 &>/dev/null&
2009-08-18 07:24:52
User: AskApache
Functions: nohup
7
Silently Execute a Shell Script that runs in the background and won't die on HUP/logout

This command runs your shell script in the background with no output of any kind, and it will remain running even after you logout.

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives

Know a better way?

If you can do better, submit your command here.

What others think

Why not:

nohup /bin/sh myscript.sh >/dev/null 2>&1 &

I even think it's not needed to redirect stdout here because nohup does redirect stdout to file "nohup.out", so this might be enough:

nohup /bin/sh myscript.sh 2>/dev/null &

I could not verify this at the moment, but the other version has quite many redirects.

Or am I wrong ?

Comment by alvinx 431 weeks and 1 day ago

I'm pretty sure you can even do it this way too which wont create a nohup file:

(/bin/sh myscript.sh >/dev/null 2>&1) &
Comment by kazler 431 weeks ago

ya the goal was to not create a nohup and display no message, it worked but you guys are right, the nohup is not neccessary... I think I just liked the nohup as it avoided the subshell problems.

Comment by AskApache 431 weeks ago

what is up with the repeated redirection?

Comment by bwoodacre 430 weeks and 6 days ago

http://www.ralph-laurenpolo.us.org

http://www.coachfactoryoutlet-coachoutlet.us.com

http://raybansunglasses.co-sunglasses.com

http://www.coachoutleto.us.com

http://www.michaelkorssoutletclearance.us.com

http://www.mont-blancpens.us.com

http://www.lunetterayban.fr

http://www.michael-korsoutletfactory.us.com

http://www.nikeoutletstorelocations.com

http://www.michaelkorsoutletshops.us.com/

http://www.valentino-outlet.us.com

http://www.cheapjordans-forsale.us.com

http://www.edhardyclothing.us.com

http://www.ralphlaurenpoloshirts.me.uk

http://www.oakleysunglasseswholesales.us.com

http://www.michaelkorsoutletonlinestore.us.org

http://www.katespadeshandbags.us

http://www.kate-spadeoutletstore.us.com

http://nikeshoes.up-nike.com

http://www.christian-louboutinshoes.us

http://www.coachoutletcoachoutletstore.us.com

http://www.raybanssun-glasses.com.co

http://www.michaelkors-outletofficial.us.com

http://www.coachoutletonlinecoachfactoryoutlet.com.co

http://www.polooutlet.name

http://www.coach-outletonlineclearance.us.com

http://www.pumaoutletstore.us.com

http://www.nike-shoes.us.org

http://www.poloralph-laurenuk.co.uk

http://www.coachfactoryoutletofficials.us.com

http://www.michaelkorsoutletclearancee.us.com

http://www.giuseppezanottioutlet.us.com

http://www.ralphlaurenofficial.us.com

http://www.michaelkorsoutlet-online.in.net

http://www.katespadeoutlet-store.us.com

http://www.michael-korsoutletstore.in.net

http://www.raybansun-glasses.com.co

http://www.montblancpens-outlet.us.com

http://poloralphlauren.amegov.com

http://www.canadagooseoutlet-store.com.co

http://www.cheapuggboots.name

http://www.adidasyeezyshoes.name

http://www.true-religionoutletstore.us.com

http://adidasyeezyshoes.adidassale.net

http://www.raybansunglassesformen.us.com

http://www.mcmoutletonline.us

http://cheapraybansunglasses.co-sunglasses.com

http://www.michaelkorsoutletofficial.com

http://www.michaelkorsoutlet-clearance.us

http://www.mbtshoescheap.us.com

http://www.oakleysunglassesfactory.us.com

http://www.ralphlaurenshirts.me.uk

http://www.longchampoutlet.us.org

http://www.nikeshoes.com.co

http://www.ralphlauren-shirts.org.uk

http://www.mlbjerseys-wholesale.us.com

http://www.polooutletralphlauren.us.com

http://www.lacosteoutlet.us.org

http://www.airjordan-retro.us.com

http://www.lebron-jamesshoes.us.com

http://www.coachoutletonlinecoachfactoryoutlets.us.com

http://www.cheapmlb-jerseys.us

http://www.michaelkorsoutlet-clearances.us.com

http://www.birkenstockoutlets.us.com

http://www.polooutlet.us.org

http://www.raybansunglassesonsale90off.us.com

http://www.nikeshoesoutlet.us.com

http://www.ralph-laurenpolooutlet.us.com

http://www.cheapnfljerseys.eu.com

http://www.airjordan.us.org

http://www.ralph-laurenoutletuk.me.uk

http://www.montblancpensoutlet.com

http://www.kate-spadeoutlet.us.org

http://www.ralphlauren-polo.me.uk

http://www.fredperryoutlet.us.com

http://www.pradaoutlet-store.us.com

http://www.cheapjordans.name

http://www.oakleysunglasseswholesaleonline.us.com

http://yeezyboost.adidassale.net

http://www.coach-outletonlinecoachfactoryoutlet.us.com

http://www.pandorajewelry-charms.us.com

http://www.pandoracharmsjewelry.org.uk

http://www.truereligionjeanss.us.com

http://www.coachoutletcoachfactoryoutlets.us.com

http://www.ralphlauren-outletuk.org.uk

http://www.asicsrunningshoes.us.com

http://www.nike-shoes.us.com

http://www.cheapraybans-sunglasses.us.com

http://www.coachfactory-outlet.eu.com

http://www.niketrainersnikeshoes.org.uk

http://www.poloralphlauren-uk.org.uk

http://www.cheapjordansfor-sale.us.com

http://www.montblancpenss.com.co

http://www.cheapuggboots.org

http://www.cheapuggs.name

http://www.canadagoosejacketss.com.co

http://www.poloralphlaurenfactorystore.us.com

http://www.fitflopssaleclearance.name

http://www.fitflops-saleclearance.us

http://www.oakleysunglassesss.us.com

http://www.coachoutletonlinesofficial.us.com

http://www.michaelkors-handbags.in.net

http://www.canadagooses.com.co

http://www.truereligionjeans-sale.us.com

http://www.michaelkorsoutletofficials.us.com

http://www.christianlouboutin-uk.org.uk

http://www.polo-ralphlaurenuk.me.uk

http://www.michaelkorsoutlet-clearance.com

http://www.coachfactoryoutletonlinestores.us.com

http://www.fitflopsaleclearance.us.com

http://www.adidasoutlet.com.co

http://www.nikeoutlet.com.co

http://www.uggoutlet.name

http://www.coachfactoryoutletstoreofficial.us.com

http://www.adidasyeezy-shoes.us.com

http://www.oakley-sunglassesoutletonline.us.com

http://www.adidasnmd-r1.us.com

http://www.mbtshoesoutlets.us.com

http://www.ralphlaurenoutlets.org.uk

http://www.poloralphlauren-uk.me.uk

http://www.christianlouboutin.com.co

http://www.canadagoose-outlets.com.co

http://polooutlet.amegov.com

http://www.pradaoutletstore.us

http://www.nba-jerseyscheap.us.com

http://www.airjordan4.us

http://raybansunglassesoutlet.co-sunglasses.com

http://www.michael-korshandbags.in.net

http://www.canadagoosejacketssale.us.com

http://www.coachoutlet-clearance.us.org

http://www.pandorajewelry-outlet.us.com

http://www.mulberryhandbagsuk.co.uk

http://www.pandoraoutletstore.us.com

http://www.fredperry.org.uk

http://www.valentinooutlet.in.net

http://www.oakley-sunglassesclearance.us.com

http://www.pandoraoutlets.us.com

http://www.oakleysunglassesformen.us.com

http://www.adidasshoes.us.org

http://www.canadagoose.name

http://www.oakleysunglasseswholesaler.us.com

http://www.coachoutletonlinestoreofficial.us.com

http://www.michael-korsoutletofficial.us.com

http://www.oakleysunglassescheaps.us.com

http://www.polo-ralphlauren-pascher.fr

http://nikeshoes.nike-com.com

http://www.oakleysunglasseswholesalee.us.com

http://www.michaelkorsoutlet-clearance.org

http://www.nhljerseyss.us.com

http://www.longchampoutletofficial.us.com

http://www.hermesbeltsoutlet.us.com

http://www.fredperrypoloshirts.co.uk

http://www.michaelkorsoutletclearancehandbags.us.com

http://www.christian-louboutinoutlet.us.org

http://www.ralphlaurenpolo-uk.org.uk

http://www.truereligion-outletstore.us.com

http://www.yeezyboost350-v2.us.com

http://www.ralphlaurenoutletonlinestore.us.com

http://www.mlbjerseys.net

http://www.adidasoutlet.us.org

http://www.hermesbirkins.us.com

http://www.coachfactoryoutletmiami.us.com

chenlili20170614

Comment by chenlili 23 weeks ago

Your point of view

You must be signed in to comment.