• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Run the script using nohup without hitting enter key two times

March 4, 2013 by Sharad Chhetri Leave a Comment

Run the script using nohup without hitting enter key two times

As we have seen when we run the command with ‘nohup’ and ‘&’ so that the command should run at background even the terminal get disconnected we have to press enter key 2 times. To overcome from this problem,use the below given method.
Note: You can write the same in script as well

nohup command_name-Or-Script-name > Output.out 2> Error.err < /dev/null &

For eg. I have a command called ABC and I want to run directly from terminal you can write like this

nohup ABC > Output.out 2> Error.err < /dev/null &

OR if you want to run this command from script,you can use it like this.
create a script file,here I am creating shell script

vi test.sh

#!/bin/bash
nohup command_name-Or-Script-name > Output.out 2> Error.err < /dev/null & Save and exit by pressing ESC key then typing :wq

Or if you have any script called SCRIPTABC which actually do not run at background. It should be run like this directlt from terminal.

nohup SCRIPTABC > Output.out 2> Error.err < /dev/null &

Note: It will crate two file Output.out and Error.err . It is good tip to use in this way. Because from this file you can also get to know what was the output or if there was any error.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Replace keyword with its filename without extension : bash script
  2. Agent admitted failure to sign using the key ssh
  3. How To Get SSH Public Key Fingerprint Information
  4. RSA key authentication in Linux : Passwordless login
  5. error: Could not load host key
  6. Create bootable usb key for CentOS 7 installation
  7. sshd error could not load host key
  8. Read the file inside compressed .gz files without extract
  9. Non interactive ,without typing password do ssh to Server : By sshpass
  10. How to change hostname in Ubuntu 12.04 and 12.10 without system restart

Filed Under: Linux, Tips And Tricks Tagged With: nohup

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Print double hyphen sign simultaneously in post of Octopress

Convert video file into gif file through command line in linux

Do not show line haveing particular keyword by grep command

Yum Error database disk image is malformed

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

30 useful Linux terminal keyboard shortcuts

Keep logs of user after sudo su – : Secondary Logging

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy