As Stated in the title, I want to start a new terminal from (say) Terminal-1. The new Terminal will execute a command (Say, start JBoss). And after starting JBoss, there will be JBoss log in Terminal-2, so i dont want to stay there as I have some other tasks to do. I want the control back to Terminal-1, so I can execute other commands. I am running script.

Example scenario: Running a script where i need to: (1) Install JBoss (2) Start JBoss (3) Deploy a code in jboss as.

NOTE: Creating a new Terminal is not a problem. I can follow this. The problem is to come back to the primary terminal for executing further command.


You can simply do :

gnome-terminal -e jboss_command; exit;

That should close the new terminal as soon as the jboss_command finishes.

However, you almost certainly don't want that. There is no reason to open a new terminal. Just run your command in the background:

jboss_command &

If that creates output, run it like this:

jboss_command &>/dev/null &

The & at the end makes a command run in the background, allowing you to keep using the terminal. &>/dev/null redirects standard error and standard output to /dev/null, it basically discards any messages printed by the command. So, running your jboss command like this will enable you to keep working on the same terminal while the command is running.

  • "jboss_command &>/dev/null &" worked perfectly for me. Thanks a million. – user1951 Apr 25 '14 at 11:32

I like using 'screen' for this sort of work. You can install it with sudo apt-get install screen and use it like this:

  • Open new screen (terminal) with screen
  • Execute your command(s) in it
  • Detach it (temporarily exit) with 'ctrl+a' release keys and then press only 'd'
  • Optionally open another one and do some stuff there too, detach that one also
  • When you want to come back type screen -ls
  • And then reattach one you want with screen -r screen_name

man screen for more!

  • any alternatives to 'ctrl+a' ? I am thinking to run a script where i dont know how to use 'ctrl+a' unfortunately. – user1951 Apr 26 '14 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.