keecode logokeecode
130

Terminated by Ctrl+C

Script terminated by Control-C

Signal

Exit Code Information

Exit Code

130

Name

Terminated by Ctrl+C

Category

Signal

Usage Context

User pressed Ctrl+C to terminate execution

Common Usage

Bash Script

#!/bin/bash

if [ condition ]; then
  echo "Terminated by Ctrl+C"
  exit 130
fi

Check Exit Code

./script.sh
echo $?  # Prints the exit code

# Check if exit code matches
if [ $? -eq 130 ]; then
  echo "Terminated by Ctrl+C"
fi

Node.js/JavaScript

// Exit with code 130
process.exit(130);

// Or throw error that results in exit code
if (error) {
  console.error('Terminated by Ctrl+C');
  process.exit(130);
}

Python

import sys

# Exit with code 130
if error:
    print("Terminated by Ctrl+C")
    sys.exit(130)