Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Linux IntroductionChapter 8. Process Management

Signals

Signals

Linux Signals

Signals in Linux are messages sent to active processes in order to interrupt them. By sending signals, you can stop, terminate or restart running processes. You can also move a foreground process to the background or the other way around.

Kill Command

The kill command is used to send a signal to an existing process. Without any option, the command sends the SIGTERM signal, which is a termination signal. For this command, you need to specify the process with the process ID or job ID. When you use the job ID, you need to put % before the job ID. The kill command can be used for both background and foreground processes.

For example, if you want to stop one of the background processes in the example in the previous section, run the command below.

Command Line - INPUT
kill 85945

By running the jobs command, you can see that the process has been terminated.

Command Line - INPUT
jobs -l
Command Line - RESPONSE
[1]  85945 Terminated              ./loop.sh > countdown_bg.txt
[2]+ 85946 Stopped                 ./loop.sh > countdown_bg.txt
[3]  85947 Running                 ./loop.sh > countdown_bg.txt &
[4]- 85949 Running                 ./loop.sh > countdown_bg.txt &

Other Signals

By running the kill command with the -l option, you can see the available list of signals.

Command Line - INPUT
kill -l
Command Line - RESPONSE
 1) SIGHUP   2) SIGINT  3) SIGQUIT  4) SIGILL    5) SIGTRAP
 6) SIGABRT  7) SIGBUS  8) SIGFPE   9) SIGKILL  10) SIGUSR1
:

For example, SIGKILL is used to forcefully terminate a process. Sometimes, SIGTERM may not terminate the process for some reason. When you really want to terminate the process, you can use this signal.

In the same example, send SIGKILL and check the result with the jobs command. You can see that the result shows that the process is killed (and not terminated).

Command Line - INPUT
kill -SIGKILL 85947
jobs -l
Command Line - RESPONSE
[2]+ 85946 Stopped                 ./loop.sh > countdown_bg.txt
[3]  85947 Killed                  ./loop.sh > countdown_bg.txt &
[4]- 85949 Running                 ./loop.sh > countdown_bg.txt &

Ctrl Z and Ctrl C

Ctrl Z and Ctrl C are also signals. These can be used for a foreground process. Ctrl Z is used to stop (suspend) a process. Ctrl C is used to terminate a process.


You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Forking: How to Start a Project with a Replica of an Existing Git Repository

Non-Member – Start Project With Replica of Existing Repository (Fork)

Sharing Your Docker Images

Sharing Your Docker Images

Designing List Page Templates in Django

Template for List Page

Django Dependency Installation on Production Servers

Django and Dependency Installation on Production Server

Deploying Your Django App

Chapter 6. Deploy Django App

Forking: How to Start a Project with a Replica of an Existing Git Repository

Non-Member – Start Project With Replica of Existing Repository (Fork)

Sharing Your Docker Images

Sharing Your Docker Images

Designing List Page Templates in Django

Template for List Page

Django Dependency Installation on Production Servers

Django and Dependency Installation on Production Server

Deploying Your Django App

Chapter 6. Deploy Django App

Tags:

Process

Job

Signal

Linux Introduction
Course Content

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server