Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop a command in the Visual Studio Code terminal

I've been stopping commands with the trash can for too long. Command period doesn't work on Mac. I can't find anywhere how to stop the terminal via a command. What is it?

like image 473
faceyspacey.com Avatar asked Aug 16 '17 10:08

faceyspacey.com


2 Answers

You can terminate with the Trash icon like you do, or press Ctrl + C. That's the shortcut from the default Terminal application and it also works in Visual Studio Code.

like image 61
PetarS Avatar answered Sep 17 '22 13:09

PetarS


In certain cases, such as running a Node.js server, Ctrl + C wouldn't work. Instead, you can stop the app or command by pressing Ctrl + Alt + M (i.e., Ctrl + Option + M for Mac users).

Sample JavaScript code to demonstrate this:

const http = require('http');  http.createServer((req, res) => {     res.write('Hello, World!!');     res.end(); }).listen(5000, () => console.log('Server running...')); 
like image 42
wintermute Avatar answered Sep 19 '22 13:09

wintermute