Linux Classroom Series – 17/Jul/2020

For this series

  • We will be using a ubuntu vm and redhat vm. Ubuntu is connected for git bash (terminal in black) and redhat from powershell Preview

Linux Job

  • A linux job is a process which shell manages. Each job is assigned with a sequential job id. But each job is process & it will also have PID
  • Jobs will have following statuses
    • Foreground:
    • Background:
    • Stopped
  • Commands:
    • jobs: List all the jobs
    • bg %n: Places the current or specified job in the background
    • fg %n: Brings the current or specified job into the foreground
    • Control-z: Stops the foreground job & places it in the background as stopped job
  • Run a Job in the Background
    • You need to enter the command followed by an ampersand &
    sleep 1d &
    • To bring jobs to foreground Preview
    • To stop the jobs Preview


  • The kill command is used to kill process.
  • The kill command doesn’t kill process rather it sends signals. Signals are one of several ways that os communicates to program
    • Ctrl-C: Send a signal called as INT(interrupt)
    • Ctrl-Z: Sends a signal called as TSTP(Terminal Stop)
  • Kill command syntax
kill -signal PID ...
  • IF no signal is specified then the TERM (terminate) signal is sent by default

Lets look at Common Signals

  • HUP: Hang up. The signal number is 1
  • INT: Interrupt. This performs same functionas CTRL-C sent from terminal. It usally terminates the program . The signal number is 2
  • KILL: Kill. This signal is special because this signal will not reach process, kernel will terminate program immedietly, so no clean up oppurtunity given to your program. Signal number is 9
  • TERM: Terminate. This is default signal sent by kill. Signal number is 15
  • CONT: Continue. This will restore the process after STOP or TSTP signal. This signal is sent by bg and fg commands. Signal number is 18
  • STOP: Stop. This signal causes a process to pause without terminating. Signal number is 19
  • TSTP: Terminal Stop. Signal number is 20

Kill with Signals

  • Samples Preview Preview

Bash nohup

  • The meaning of nohup is ‘no hangup’.
  • Normally when we logout from system then all the running programs or process are hangup or terminated. If you want to run any program after logut or exit from Linux OS then you have use nohup command.

Shutting down the system

  • Four commands
    • halt
    • poweroff
    • reboot
    • shutdown

Other Useful Process Commands

  • pstree
  • vmstat
  • xload
  • tload

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin