Processes, Jobs, and Stopping Things
What this is. Every running program is a process with a numeric id. When something is stuck, consuming your machine, or holding a port you need, these are the commands that deal with it.
ps aux lists every process.
ps aux | grep node finds the ones you care about.
kill 1234 asks a process to stop.
kill -9 1234 forces it, and should be a last resort.
✦ Ask before you force
Plain kill sends a polite request, and a well written program uses it to finish writing files and close connections before exiting. kill -9 cannot be caught or refused, so the process stops immediately with no chance to clean up, which can leave half written files behind. Try kill first every time, and reserve -9 for something that genuinely will not respond.
Foreground, background, and getting your prompt back.
A command with & after it runs in the background, handing your prompt straight back.
jobs lists what you have backgrounded in this shell.
Control and C interrupts whatever is running in the foreground.
Control and Z suspends it, and fg resumes it in the foreground.
The shortcuts that make the terminal comfortable. These are worth practicing deliberately, because they are the difference between fighting the line and editing it.
Control and C stop. Control and L clear the screen. Control and R search your history. Control and A jump to the start of the line, Control and E to the end. Control and U delete backwards to the start, Control and K forwards to the end. And the up arrow walks back through previous commands.
Mark this lesson complete
Signed in, your progress follows you to every device.