LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   ctrl+z causes hang? (https://www.linuxquestions.org/questions/linux-general-1/ctrl-z-causes-hang-456125/)

slinky2004 06-19-2006 01:25 AM

ctrl+z causes hang?
 
Whenever i start my computer up, the first program that i run hangs when i try to suspend it with ctrl+z.

So, for example: i boot up, log in, run the "yes" command, hit ctrl+z, and "yes" hangs, i have to go to tty2 and do a kill -9 on yes. after that i can suspend a job with no problem, but its really annoying if i forget because i'll start up X and run something like firefox from a terminal, then try to ctrl+z out of it(after a little browsing), and hang firefox.

a fix would be nice, but i'm also just plain interested in finding out what's causing it. i think it may be something involving the kernel or sighup or something, but i really have no clue.

i'm running a very fresh install of slackware 10.2 with the slackware bare.i kernel. any ideas?

druuna 06-19-2006 03:38 AM

Hi,

ctrl-z is used to suspend programs, not to stop them. To resume the program after a ctrl-z use: fg

ctrl-d can be used to stop programs (not all).

man bash for details (Job Control section).

Hope this clears things up.

spooon 06-19-2006 05:20 AM

Ctrl-C is used to stop many programs. Ctrl-D is the end-of-file character, which tells things like the shell that it's done.

timmeke 06-19-2006 10:02 AM

Shell job control 101. See man bash for details.

Sending Ctrl-Z suspends a job, "fg" continues it in foreground as posted already. "bg" continues it in the background (useful to keep firefox open while continuing typing commands in your terminal).

Launching jobs with "&" afterwards should launch them directly in the background.
ie try:
firefox &
instead of just
firefox
and you'll be able to continue working in your terminal (command line) and firefox is still started.

I'd go with spooon's suggestions. Ctrl-D is typically used to close off input streams too.
Try using:
mail -s some_subject some_destination
=> this will start mail and allow you to type in the mail's body.
=> End the e-mail content with Ctrl-D.
and voilą, the mail gets sent out...
Similarly, try doing just:
cat
and stopping that with Ctrl-D, Ctrl-Z, etc and see what the difference really is.

slinky2004 06-19-2006 01:12 PM

sorry about that, i mixed up stop and suspend. any ideas why the first program i run hangs when i try to suspend it?

katayamma 06-19-2006 01:50 PM

Quote:

Originally Posted by slinky2004
sorry about that, i mixed up stop and suspend. any ideas why the first program i run hangs when i try to suspend it?

OK, maybe you haven't quite defined this hang event for us.

When you ctl-z a program, it suspends. It doesn't die, just sits around waiting for you to do something while you have a command prompt back. Are you getting the prompt, or does output of 'yes' stop and you get no prompt?

If you have the prompt, does doing a 'bg' continue the process?

Thx

slinky2004 06-19-2006 11:41 PM

i don't get the prompt back. the program stops(in the case of "yes" it stops printing y), but i don't get the prompt back. thats why i have to switch to another tty in order to kill it.


All times are GMT -5. The time now is 04:15 AM.