Day 4 of 5
⏱ ~60 minutes
Linux in 5 Days — Day 4

Processes and System Monitoring

View running processes, manage them, control services with systemctl, and monitor disk and memory.

Viewing Processes

Process commands
# List all processes
ps aux
# ps aux | grep nginx   ← find a specific process

# Interactive process viewer
top         # built-in, Ctrl+C to exit
htop        # prettier version (install if needed)

# htop keys:
# F9 = kill process
# F6 = sort by column
# / = search
Signals and Kill
# Get PID from ps aux output
kill 1234              # send SIGTERM (graceful)
kill -9 1234           # send SIGKILL (force kill)
killall nginx          # kill all processes named nginx
pkill -f 'python app'  # kill by command pattern

# Background jobs
sleep 60 &             # run in background
jobs                   # list background jobs
fg %1                  # bring job 1 to foreground
bg %1                  # continue job 1 in background
systemctl: Managing Services
# Start/stop/restart
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx  # reload config without restart

# Enable/disable on boot
sudo systemctl enable nginx
sudo systemctl disable nginx

# Check status
systemctl status nginx
journalctl -u nginx -f    # follow nginx logs
Disk and Memory
df -h                  # disk usage by filesystem
du -sh ./mydir/        # size of a directory
du -sh * | sort -h     # sizes of all items, sorted

free -h                # memory usage
cat /proc/meminfo      # detailed memory info

# Find large files
du -ah . | sort -rh | head -20
📝 Day 4 Exercise
Monitor Your System
  1. F
  2. i
  3. n
  4. d
  5. t
  6. h
  7. e
  8. P
  9. I
  10. D
  11. o
  12. f
  13. a
  14. r
  15. u
  16. n
  17. n
  18. i
  19. n
  20. g
  21. p
  22. r
  23. o
  24. c
  25. e
  26. s
  27. s
  28. .
  29. S
  30. t
  31. o
  32. p
  33. i
  34. t
  35. .
  36. S
  37. t
  38. a
  39. r
  40. t
  41. a
  42. s
  43. e
  44. r
  45. v
  46. i
  47. c
  48. e
  49. w
  50. i
  51. t
  52. h
  53. s
  54. y
  55. s
  56. t
  57. e
  58. m
  59. c
  60. t
  61. l
  62. .
  63. C
  64. h
  65. e
  66. c
  67. k
  68. i
  69. t
  70. s
  71. s
  72. t
  73. a
  74. t
  75. u
  76. s
  77. .
  78. F
  79. i
  80. n
  81. d
  82. t
  83. h
  84. e
  85. t
  86. o
  87. p
  88. 5
  89. l
  90. a
  91. r
  92. g
  93. e
  94. s
  95. t
  96. d
  97. i
  98. r
  99. e
  100. c
  101. t
  102. o
  103. r
  104. i
  105. e
  106. s
  107. i
  108. n
  109. /
  110. v
  111. a
  112. r
  113. .
  114. C
  115. h
  116. e
  117. c
  118. k
  119. m
  120. e
  121. m
  122. o
  123. r
  124. y
  125. u
  126. s
  127. a
  128. g
  129. e
  130. .

Day 4 Summary

  • ps aux | grep name finds a process. kill PID stops it. kill -9 forces it.
  • systemctl start/stop/restart/enable/status service — the full service management toolkit.
  • journalctl -u service -f follows a service's logs in real-time.
  • df -h shows disk usage. du -sh dir/ shows directory size. free -h shows memory.
Finished this lesson?