17

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?

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311
Easton
  • 171

5 Answers5

9

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

DavidPostill
  • 162,382
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).

Rich Homolka
  • 32,350
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.

Hawken
  • 226
0

In a new terminal, use the killall command.

HackToHell
  • 6,408
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.

ggustafsson
  • 2,024