Find the answer to your Linux question:
Results 1 to 6 of 6
Hello. This is a pretty simple question, and it has probably already been asked, but I cannot find it. When I execute an application in a terminal (opened from the ...
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Location
    Delaware
    Posts
    1

    Executing applications in a terminal without losing the prompt

    Hello. This is a pretty simple question, and it has probably already been asked, but I cannot find it.

    When I execute an application in a terminal (opened from the GUI) that opens a new window (emacs, for instance), the terminal prompt is gone as long as the application is running.

    I know there is a way to open the programs without losing the prompt...I have done it before...but I cannot remember. I believe it involves putting some character at the beginning or the end of the command.

    Thank you.

  2. #2
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,095
    Welcome to the forums!

    Try it like this:

    Code:
    app_name -e &
    or just...

    Code:
    app_name &
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  3. #3
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    The & at the end of the commandline means "Run this in the background". This disconnects the application from the terminal: it won't keep the terminal busy, but you can't use the terminal to communicate with the program. Therefore, for something like emacs that opens a new window, this is fine, but a program that requires terminal input will not work.

    Hope that helps!
    DISTRO=Arch
    Registered Linux User #388732

  4. #4
    Linux Newbie egan's Avatar
    Join Date
    Feb 2009
    Location
    Mountain View, CA
    Posts
    132
    And if you start a program in the normal way, do the input you need to do, and then want the prompt back, you can press Control Z to suspend it. You can then do other commands and such. If you want to program to continue running in the background, type bg after suspending it. If you want to restart it in the foreground, type fg.

    If you have multiple jobs as they are called, you can refer to specific ones with %# where # is the # of the job. To get a list of suspended and backgrounded jobs you can type jobs at the prompt. When jobs finish they will notify you on a prompt refresh.

  5. #5
    Linux Newbie
    Join Date
    Nov 2007
    Location
    Planet Earth
    Posts
    152
    Just to show another (powerfull) option: the screen program.

    This is a very nice program because you can start a program not only in background, but using a different process and even, close the terminal (or remote session) and recover the screen's session later. Just start a terminal and type

    $ screen

    and this starts a new screen's session... basically, a new terminal. Execute any program, and press Ctrl + A, then D to detach the session.

    At this moment you can close your terminal or even your (remote) session, and start a new terminal and use:

    screen -r

    to recover the detached session. It's like magic

    Very nice and usefull if you often use remote sessions.

    Greetings,

    Hugo
    EOF

  6. #6
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    Or you can just open another console. Most distros create 6 virtual consoles for you and open your GUI desktop (if you've got one) on console 7. You can switch between virtual consoles by using ALT-Fn where n is the number of the console you want. You have to log on at each console but after that, switching between them is easy.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...