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?

  • 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
  • What worked for me, was doing Cmd + R. Then those short cuts work again. – Snickers3192 Mar 3 at 14:58

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.

|improve this answer|||||
  • Is there a source that says that its actually running that two commands? – Pacerier Aug 15 '17 at 23:51

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).

|improve this answer|||||

If you are using a MAC keyboard Command+dot/period should be equivalent to Ctrl+C for break.

For Ctrl+Z use Command+Z for UnDo and Shift+Command+Z for ReDo.

Refer to the Terminal Help > Keyboard Shortcuts

|improve this answer|||||

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.

|improve this answer|||||

In a new terminal, use the killall command.

|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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.