Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I setup a virtual pentest lab on my Mac.

When I am using lanmap2, every time I try to stop it with Ctrl+Z it just types ^Z, but if I type Ctrl+C, the entire terminal window closes.

Are there any commands that I can use to stop the process instead of using a keyboard shortcut?

share|improve this question
There's a setting under Terminal's preferences -> Profiles -> Shell called "When the shell exits:" and it gives you the option to close or not close the terminal window. – Marvo Jul 23 '15 at 21:10

How are you starting the program? If you double-click you're actually running two commands

 <program>; exit;

This will close the window after the program has executed.

If this is the case try launching lanmap2or whatever your program is in a new terminal window. This way ctrl + c will only close out of the program not the window.

As for ctrl + z I have yet to find anything that would stop that from working.

share|improve this answer

I'd try stty -a in the Terminal, see what your cchars are mapped to. Make sure that susp (suspend) is mapped to Ctrl-Z (^Z) and intr (interrupt) to ^C.

Do you have any programs running that may 'steal' the keypress? Maybe somecoolapp uses Ctrl-Z to send a zebra Twitpic someplace.

Remember that Ctrl-C will close your window if all the processes under it go away. I don't know how you run your app, but if it replaces bash by using exec, then the 'Ctrl-C closes window' makes a bit more sense. Ctrl-C closes the foreground app, which is the only thing running, which closes the window.

To suspend the process, you could use another terminal window to send the signal. Find the process ID using either Activity Monitor or the ps command, and in the other window type kill -STOP <processid>. Unfortunately Activity Monitor doesn't seem to let you send just any signal, and SIGSTOP and SIGCONT are not in the list (at least on Snow Leopard, which is what I can check).

share|improve this answer

In a new terminal, use the killall command.

share|improve this answer
No im not trying to copy the command window, Im trying to stop the process so I can make a map of the networks. I'm new to all this so basically I might not be using the right terminology but, Im having a hard time trying to output the image from the ping results. – Easton Feb 26 '12 at 4:59
@Easton I edited my answer, try it out – HackToHell Feb 26 '12 at 5:15

Maybe what you want is Ctrl+S? That temporarily stops the output of the running program. Ctrl+Z suspends the program so you can go back to the shell and do something and then get back to the program again with the fg command.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .