Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open multiple instances of a program in Linux

Say for example, to open multiple instances of gedit editor I wrote a shell script like this-

gedit&
gedit&
gedit&
gedit&

But after I ran my shell script ./example.sh, I can find only one instance of gedit! I've even used the & operator, so that the shell doesn't wait for one instance to finish. Still I cannot see four instances of gedit.

Also I tried directly from the command prompt. If I just enter gedit& on the command line, it showed 1906 ( this is the PID of the newly created gedit process ), started one new gedit instance and returned to prompt again. When I typed gedit& on the command line, it showed 1909 this time, but no new instance of gedit! And I couldn't find any process with PID 1909 in the System Monitor too. Where did this new process go away?

Is the happening specific to gedit? If so, what is the generic behavior when creating multiple instances of a program?

like image 362
Pavan Manjunath Avatar asked Sep 26 '11 10:09

Pavan Manjunath


People also ask

How do I open multiple instances of an app in Linux?

Instead, to open another instance of the program, simply middle mouse click (or if you're on a laptop, press both left button and right button simultaneously to simulate a middle click) on the icon which will spawn a new window with the same application.

How do I open a second instance?

Open multiple instances of an app using Shift + Click Then, hold down the Shift key on your keyboard and click with your cursor - or tap with your finger - on its taskbar icon. One click or tap opens a new instance, two clicks or taps open two, and so on.

How do I run multiple commands in parallel Linux?

On Linux, there are three ways to run multiple commands in a terminal: The Semicolon (;) operator. The Logical OR (||) operator. The Logical AND (&&) operator.

What are instances in Linux?

An instance is a virtual server in the AWS Cloud. With Amazon EC2, you can set up and configure the operating system and applications that run on your instance. When you sign up for AWS, you can get started with Amazon EC2 using the AWS Free Tier .


1 Answers

It is specific to gedit. You are likely looking for gedit --new-window &.

From man gedit:

--new-window
       Create a new toplevel window in an existing instance of gedit.
like image 175
etuardu Avatar answered Sep 21 '22 15:09

etuardu