Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello,
How to find job_id of a process bg'ed.i mean how to get the job_id for running "fg" command?
I tried pid,but fg command insists on job_id.please help me which command will display job_id.
thanks
now how do i use fg and bg without job_id :? for eg; i invoked firefox from terminal without "&".now if i want to detach the process from shell,how can we achieve it :? i am aware of pid,but job id is something new for me thanks,waiting for reply :-|
A job is a concept which is only meaningful inside the shell. Please read the JOB CONTROL section of the bash manual page for an overview (search for upper case JON CONTROL).
When a shell is closed, any backgrounded jobs attached to that terminal are send a signal SIGHUP (hang up). Most programs will terminate when they receive this signal. A program may choose to do something else other than terminate on receiving SIGHUP. At least in Ubuntu, firefox seems to be one of these, so you can just bg the process and then close the terminal.
For programs which terminate when you close the terminal which they are attached to, you have a few options:
When you start the program by prefixing it with "nohup", for example:
Code:
nohup myprogrm &
Run the program in GNU Screen. Screen lets you detach the shell from the terminal, and then re-attach it at a later date. This is particularly useful for programs like terminal-based IRC clients... For you can detach the screen session from the terminal which is funning locally, log out, go to work and ssh to your machine and then re-attach to the shell running the IRC client.
You can use the disown shell internal to remove the job from the shell's process group. This means it will not be sent a SIGHUP when the terminal is closed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.