LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 05-11-2011, 03:55 PM   #1
jimmyrp
LQ Newbie
 
Registered: May 2011
Posts: 9

Rep: Reputation: 0
Using Bash shell when I run a program from it


So I open firefox from my bash shell with:

Code:
firefox google.ca
it opens firefox, I can browse, etc.
Now if I alt-tab back into my shell, i can't enter any commands in the shell.

I know that i can do this if I close firefox, but I want to keep working in my shell with firefox still open.

Is this possible?
 
Old 05-11-2011, 03:58 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,791
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Welcome to LQ!

firefox google.ca &

If you add an ampersand after a command, it detaches the command and you can get back to the prompt. The nohup command (nohup firefox google.ca) will do something similar.

If you really want to get fancy, you can use the screen command to create virtual terminals that you can detach and re-attach whenever you want.
 
Old 05-11-2011, 03:59 PM   #3
jimmyrp
LQ Newbie
 
Registered: May 2011
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks a lot!
 
Old 05-11-2011, 05:23 PM   #4
r_s
Member
 
Registered: May 2009
Distribution: slackware, fedora, ubuntu
Posts: 94

Rep: Reputation: 21
press ctrl+z this will send the SIGSTOP signal.
Then type bg, this will send the process in the background, you can do fg to bring it in the forefront.
 
Old 05-12-2011, 12:29 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Also, if you don't want output from the background command cluttering up your terminal as you work, do this:

Code:
firefox google.ca &> /dev/null &
And finally, remember to mark the thread as solved.
 
1 members found this post helpful.
Old 05-15-2011, 01:39 PM   #6
astromime
LQ Newbie
 
Registered: May 2011
Posts: 26

Rep: Reputation: 13
you can also check your jobs list for jobs running in the background with the command...jobs

so if you are running alot of commands in the background, use jobs to get the job number, and you can bring it to the foreground if you wish to by typing fg JOBNUMBER

not relevant here really, but useful
 
Old 05-15-2011, 01:54 PM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Another useful tip: you can keep the command running after you close the terminal using the nohup command.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
in bash shell how to run shell script during startup rammohan04 Red Hat 2 07-31-2009 03:07 AM
Run a C Shell using only Bash shell HSN Linux - Software 1 12-25-2006 08:44 AM
Run interactive program in shell escargot22026 Programming 4 08-15-2004 12:59 AM
Simple Bash Shell Program frankblack Programming 2 02-15-2003 12:59 AM
bash shell program help embsupafly Programming 7 11-27-2002 01:05 AM


All times are GMT -5. The time now is 12:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration