LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-19-2006, 01:25 AM   #1
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Rep: Reputation: 30
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?

Last edited by slinky2004; 06-19-2006 at 01:11 PM.
 
Old 06-19-2006, 03:38 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 06-19-2006, 05:20 AM   #3
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
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.
 
Old 06-19-2006, 10:02 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
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.
 
Old 06-19-2006, 01:12 PM   #5
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Original Poster
Rep: Reputation: 30
sorry about that, i mixed up stop and suspend. any ideas why the first program i run hangs when i try to suspend it?
 
Old 06-19-2006, 01:50 PM   #6
katayamma
Member
 
Registered: Jan 2006
Posts: 37

Rep: Reputation: 15
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
 
Old 06-19-2006, 11:41 PM   #7
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Original Poster
Rep: Reputation: 30
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.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ctrl+c & ctrl+v equivalent for Gnome terminal window? halfpower Linux - General 2 11-29-2005 02:57 AM
dark screen when pressing Ctrl + Alt + Backspace or Ctrl + Alt F1-F6 in Gnome or KDE trinoo Slackware 5 01-28-2005 08:13 AM
GeForce, Hang on boot, hang on X ctrl-alt-bspace bigearsbilly Linux - Hardware 0 03-01-2004 07:56 AM
no ctrl-a or ctrl-z in emacs or on command line? ashlock Fedora 5 12-30-2003 08:00 PM
ctrl+ c ctrl +v not working in windows xp Astro General 3 10-20-2003 08:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:16 PM.

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