System Services

System service management and monitoring commands

Service Management (systemctl)

System service management with systemctl

# Start service
sudo systemctl start service_name

# Stop service
sudo systemctl stop service_name

# Restart service
sudo systemctl restart service_name

# Reload service
sudo systemctl reload service_name

# Enable service at boot
sudo systemctl enable service_name

# Disable service at boot
sudo systemctl disable service_name

# Check service status
systemctl status service_name

# Show service logs
journalctl -u service_name

# Show service logs with follow
journalctl -u service_name -f

# Show service logs since boot
journalctl -u service_name -b

# Show all services
systemctl list-units --type=service

# Show failed services
systemctl --failed

# Mask service (prevent starting)
sudo systemctl mask service_name

# Unmask service
sudo systemctl unmask service_name

# Show service dependencies
systemctl list-dependencies service_name
Individual commands:
sudo systemctl start service_name
sudo systemctl stop service_name
sudo systemctl restart service_name
sudo systemctl reload service_name
sudo systemctl enable service_name
sudo systemctl disable service_name
systemctl status service_name
journalctl -u service_name
journalctl -u service_name -f
journalctl -u service_name -b
systemctl list-units --type=service
systemctl --failed
sudo systemctl mask service_name
sudo systemctl unmask service_name
systemctl list-dependencies service_name
Process Management

Process monitoring, management, and troubleshooting

# Show all processes
ps aux

# Show processes in tree format
ps auxf

# Show processes by user
ps -u username

# Show processes by PID
ps -p 1234

# Show process with full command
ps -ef

# Show process with threads
ps -eLf

# Kill process by PID
kill 1234

# Force kill process
kill -9 1234

# Kill process by name
killall process_name

# Kill all processes by name
killall -9 process_name

# Send signal to process
kill -HUP 1234

# Show process by port
lsof -i :80

# Show process by file
lsof /path/to/file

# Show process tree
pstree

# Show process with CPU usage
top -p 1234

# Show process with memory usage
pmap 1234
Individual commands:
ps aux
ps auxf
ps -u username
ps -p 1234
ps -ef
ps -eLf
kill 1234
kill -9 1234
killall process_name
killall -9 process_name
kill -HUP 1234
lsof -i :80
lsof /path/to/file
pstree
top -p 1234
pmap 1234