LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 02: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, 02:58 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
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, 02:59 PM   #3
jimmyrp
LQ Newbie
 
Registered: May 2011
Posts: 9

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

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, 11:29 AM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
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, 12: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, 12:54 PM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
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



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 02:07 AM
Run a C Shell using only Bash shell HSN Linux - Software 1 12-25-2006 07:44 AM
Run interactive program in shell escargot22026 Programming 4 08-14-2004 11:59 PM
Simple Bash Shell Program frankblack Programming 2 02-14-2003 11:59 PM
bash shell program help embsupafly Programming 7 11-27-2002 12:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:38 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
Open Source Consulting | Domain Registration