πŸš€Day 2: Users, Processes, systemctl & journald

Series: 30 Days DevOps Interview Preparation
Author: Tathagat Gaikwad


πŸ‘‹ Introduction

Welcome to Day 2 of the 30 Days DevOps Interview Preparation Challenge!
Today, we go beyond file systems and permissions and explore how Linux handles users, processes, service management (systemctl), and logging (journald).

These are key skills in troubleshooting, monitoring, and managing systems as a DevOps or Cloud Engineer.


πŸ” Linux Users & Groups

πŸ§‘ Types of Users

  • Root: The superuser with full access

  • System Users: Created by the OS or services (like nginx, mysql)

  • Normal Users: Created for real human logins

πŸ“„ Important Files

  • /etc/passwd – User account information (username, UID, shell)

  • /etc/shadow – Password hashes and password expiration

  • /etc/group – Group information

πŸ”§ Common User Commands

# Add a new user
sudo useradd devops_user

# Set password for a user
sudo passwd devops_user

# Modify user (add to group)
sudo usermod -aG docker devops_user

# Show user groups
groups devops_user

# Get user info
id devops_user

βš™οΈ Linux Processes

A process is any running instance of a program.

🧩 Process Attributes

  • PID (Process ID): Unique identifier

  • PPID (Parent PID): ID of parent process

  • Nice Value: Priority of a process

  • State: Running, Sleeping, Zombie, etc.

πŸ“ˆ Useful Process Commands

ps aux             # Show all running processes
top                # Live system view
htop               # Interactive process viewer (must install)
kill -9 <pid>      # Force kill process
nice -n 10 <cmd>   # Start a process with priority
renice -n -5 <pid> # Change priority of existing process

πŸ§ͺ Practice

  • Find top CPU-consuming process using top

  • Kill a hanging process using kill -9

  • Launch a background process: sleep 300 &


πŸ”„ systemctl (Systemd Service Manager)

systemctl is the command-line tool to control services in SystemD-based Linux distributions.

πŸ”§ Common Commands

# Check status of a service
sudo systemctl status sshd

# Start / Stop / Restart a service
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx

# Enable/disable service to run at boot
sudo systemctl enable docker
sudo systemctl disable docker

# Reload systemd manager config
sudo systemctl daemon-reexec

βœ… Tip:

Use systemctl is-enabled <service> to verify startup behavior.


πŸ“œ journald – SystemD Logging

SystemD includes journald, a logging service that replaces traditional syslog.

πŸ” Use journalctl to View Logs

# All logs
journalctl

# Logs for a specific unit/service
journalctl -u docker

# Logs since last boot
journalctl -b

# Follow live logs like tail
journalctl -f

# Show logs for specific time
journalctl --since "2 hours ago"

πŸ§ͺ Practice

  • Stop a service and view its failure log with journalctl -xe

  • Monitor system logs live while restarting a service


🎯 Interview Preparation

🧠 Sample Questions:

  • What’s the difference between /etc/passwd and /etc/shadow?

  • How can you check which groups a user belongs to?

  • What is the difference between ps, top, and htop?

  • How would you troubleshoot a service that fails to start?

  • How do you inspect logs of a service started via systemd?


βœ… Wrap-Up

Understanding how Linux handles users, processes, and system services is critical in debugging, managing workloads, and automating infrastructure in a DevOps role.

#DevOps #Linux #Systemctl #ProcessManagement #Journalctl #30DaysOfDevOps #InterviewPrep #ShellScripting #CloudEngineer

0
Subscribe to my newsletter

Read articles from Tathagat Gaikwad directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tathagat Gaikwad
Tathagat Gaikwad