How to clean launch a GUI app via the Terminal (so it doesn't wait for termination)?


Suppose gedit is the program you want to run detached (aka. "disown", "disentangle", "decouple"). There are different ways depending on what you want to do exactly:

Program already running


disown -h is the way to go if you want to do that with an already running program (i.e. if you forgot to nohup it). You first have to stop it using Ctrl+Z. Then you can put in in the brackground using bg [jobId] (e.g. bg 1). You get a list of running jobs with their jobId using jobs. After that you can decouple it from terminal using disown -h %[jobId]. Example terminal session:

confus@confusion:~$ gedit ^Z [1]+ Stopped gedit confus@confusion:~$ jobs [1]+ Stopped gedit confus@confusion:~$ bg 1 [1]+ gedit & confus@confusion:~$ disown -h %1 confus@confusion:~$ exit

Program not started yet


nohup is not always present on all machines. If you know you want to decouple beforehand you would use:

nohup gedit &

Maybe you...

0 0

We all know how to launch applications from the GUI with a double-click on the icon or clicking on the app in the Dock, and there are numerous ways to do so, and they’re all relatively speedy. If you spend a decent amount of time with the command line though, it’s nice to be able to launch Mac apps directly from there as well. Also, the Terminal has a fair share of applications that run in text based mode, but maybe you wanted to edit a text file in the OS X GUI app TextWrangler rather than the text based nano or vim.

We’re going to demonstrate how to launch any graphical Mac app from the command line of OS X, including how to open specific files from the command line with a GUI app, and how to edit and open those files with root access if it’s necessary.

Opening Mac OS X Applications from the Command Line

The Terminal command to launch OS X gui apps is appropriately called ‘open’ and here is how it works at it’s most simple:

open -a...

0 0

If you are new to Ubuntu or the command line here are a few useful software related commands that will help you maintain your system software with just a few key presses.

How To Use The Commands

All of the following commands are executed in the terminal (also known as the CLI), the quickest way to access the terminal is with the keyboard short-cut Ctrl+Alt+t.

NOTE: Commands that begin with 'sudo' will prompt you to enter your user password, this is because the command requires 'root privileges' and ensures that it is not run by an unauthorised user.

Basic Software Commands

For a more in-depth explanation take a look at our FAQ style introduction to apt-get & apt-cache.

Managing External Software Sources (PPAs)

To install an application using the command line, or Ubuntu Software Centre, the application must first be available in your software repository. PPAs (Personal Package Archives) are used add external software packages that...

0 0

I am writing an automation script and it would be nice to be able to launch Terminal on my mac via my Python script in order to launch the Appium servers, instead of doing it manually.

The closest I've come is by using the following code, but this only launches Terminal and I am unable to send commands to it:

from subprocess import Popen, PIPE, STDOUT Popen(['open', '-a', 'Terminal', '-n'], stdout=PIPE, stdin=PIPE, stderr=STDOUT)

I need to be able to launch two Terminal instances and run the following

'appium' 'appium -a -p 4724'

You have to use communicate to send cmd to your terminal.

from subprocess import Popen, PIPE, STDOUT p1 = Popen(['open', '-a', 'Terminal', '-n'], stdout=PIPE, stdin=PIPE, stderr=STDOUT) p2 = Popen(['open', '-a', 'Terminal', '-n'], stdout=PIPE, stdin=PIPE, stderr=STDOUT) p1.communicate('appium') p2.communicate('appium -a -p...
0 0

Hi Chao Shu,

Under Windows Vista and later version of systems, a windows service is running in an isolated session but not the context of any user. It can not interact with the user and the desktop.

But you're able to run a batch file in a windows service. So I suggest that you create a batch file ,run the desktop app with parameters in the batch file. Then run the batch file using Process class in the windows service.

The code in the batch file is like this:

start "Window Name" "E:\path with spaces\app.exe" param1 "param with spaces"

However if you don't want to do this, it seems that you have to use another desktop application instead of a windows service.

MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

0 0

Possible Duplicate:
How to clean launch a GUI app via the Terminal (so it doesn't wait for termination)?

If I have a terminal open in X-window, I can start a GUI app from the terminal. If I give Ctrl+C, the GUI app closes and you get back the prompter in the terminal so you can write commands again.

For example: If I run gedit, it starts but it doesn't return control to that console so I cannot reuse it for other commands, If I want to regain control I need to do Ctrl+C, but that closes the GUI app. I need the GUI app to keep running but also to use further the console to start other apps or run other commands.

How to start a X-window app from terminal console, without leaving that console occupied solely by that app?

Simply add & to your call to start it as background process.


gedit sometext.txt &

I advise you to use gksudo if that app needs administrative access with the &

gksudo gedit sometext.txt...
0 0

If you add an ampersand to the end of the line, e.g.:

xclock &

The GUI process will be run as a background job from the perspective of the terminal. Output will still go to the terminal, so you may want to redirect that, but it won't wait for the GUI program to terminate before giving back a prompt.

You can suspend a process that you started in the foreground (i.e. normally) by hitting Ctrl-Z (in the terminal), and you should get a number in brackets and message saying "Stopped" and the command printed to the terminal, for example, for top:

[1]- Stopped top

If you then type bg and the number in brackets, it'll resume the program in the background. You can also type jobs to list background and suspended processes you've created from that shell.

To put a process back in the foreground, use fg and the number, instead.

Note that if you quit the shell, things you've put in the background will still get killed -- to avoid that, use...

0 0

When an application freezes, shutting down your Mac isn't always a good option, especially when there are unsaved documents open in other windows. Using Terminal is an option to force quit applications using its command line interface. Terminal also has a utility called "top" that you can often use to pinpoint the process behind the problems and force it to quit without affecting other applications.

Step 1

Launch Terminal on your Mac computer. Click "Applications" in the left column of a Finder window followed by "Utilities," and then double-click "Terminal." Alternatively, launch Terminal from Spotlight by pressing the "Command" button and "Space Bar" at the same time. You can then just type "terminal" in the Spotlight search field and press "Enter."

Step 2

Wait a second or two for Terminal to load. When it shows the name of your Mac and your username followed by a rectangle, you can begin typing. The rectangle indicates the cursor.


0 0
Others have pointed out that there are numerous other ways to reach your goal.

To create a script that does exactly what you wanted to do from the details:

Open your favourite text editor (I’m partial to emacs, but any old basic text editor will do).

Enter the following:

#!/bin/sh cd /path/to/your/wine/directory xterm -hold -e wine ./steam.exe -no-dwrite

You need to replace “/path/to/your/wine/directory” with the actual absolute path to your wine directory.

Save it in a directory that is in your search path ( ~/bin ) is a good candidate, it’s added to the search path if it exists by default in most major distributions I’ve yet come across. If that doesn’t work, you’ll have to read up on search paths and how to set them up – an in-depth explanation of shell variables and start-up scripts here would definitely go too far.

One caveat: If you’ve just created that directory, it will only be automatically added to your path by interactive shells...

0 0

EqualLogic: How to launch the Dell PS Series Group Manager GUI application using a browser without Java plug-in support

Oracle announces the deprecation of the Java browser plug-in, and many browser vendors have discontinued supporting standards based plug-ins.


When launching the Group Manager GUI via a browser, the launch setting defaults to Launch in browser window using the Java plug-in and not to Launch as an application using Java Web Start.

The option to Launch as an application is presented only during some error conditions, an example being the user is not willing to install the required Java Runtime Environment (JRE), as well as, upon logout from the current GUI session within the browser.

Using a browser which does not support Java plug-in will result in the Group Manager GUI prompting the user to install/update their Java version (Figure 1 [English-only]).

Figure 1: Install / Update Java Version Message

0 0
It's not possible to do it without launching the command prompt. You can hide the command prompt immediately after the GUI is launched, but it still needs to be there for a second.

There are a couple of ways of doing this. First off, with Win32::Gui you can use something like:

my ($dos) = Win32::GUI::GetPerlWindow(); Win32::GUI::Hide($dos);

That you can use within the application and it will hide the DOS window/command prompt almost immediately.

And I've used the following to perform the same function in TK, though this is a "wrapper" program to launch a program and it exits. So, this program runs in a command prompt, which exits, and launches a new perl interpreter that does not open a command prompt.

#!/usr/bin/perl -w # loader - starts Perl scripts without the annoying DOS window use strict; use Win32; use Win32::Process; # Create the process object. Win32::Process::Create($Win32::Process::Create::ProcessObj, 'C:/perl5/bin/perl.exe', # Whereabouts of...

0 0