14

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?

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

5 Answers 5

7

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

2
  • 1
    Nothing seams to work... I do not understand reason for ZSH. Is the way to replace it with something reliable?
    – MrHIDEn
    Aug 17, 2021 at 8:35
  • Thank you! I've been dealing with this issue for some time. On mac, ctrl+c only suspends I guess because node processes continue to use their respective ports. Command+dot uses SIGINT and properly kills the process and port.
    – Mertafor
    May 20 at 9:43
5

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

3

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.

1
  • Is there a source that says that its actually running that two commands?
    – Pacerier
    Aug 15, 2017 at 23:51
0

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.

-1

In a new terminal, use the killall command.

2
  • 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, 2012 at 4:59
  • @Easton I edited my answer, try it out
    – HackToHell
    Feb 26, 2012 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.