0% found this document useful (0 votes)
5 views3 pages

DevOps Commands

The document is a handbook detailing various DevOps and DevSecOps commands along with their purposes and real-world use cases. It covers commands related to service management (systemctl), log monitoring (journalctl), task scheduling (cron), process management (ps and top), network analysis (ss), file searching (find), and text searching (grep). Each command is accompanied by practical examples to illustrate its application in a DevOps context.

Uploaded by

Prasanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

DevOps Commands

The document is a handbook detailing various DevOps and DevSecOps commands along with their purposes and real-world use cases. It covers commands related to service management (systemctl), log monitoring (journalctl), task scheduling (cron), process management (ps and top), network analysis (ss), file searching (find), and text searching (grep). Each command is accompanied by practical examples to illustrate its application in a DevOps context.

Uploaded by

Prasanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DevOps / DevSecOps Command Handbook

Commands, Purpose, and Real-World Use Cases

systemctl
Command: systemctl status nginx
Purpose: Check service status
Real-World Use Case: Verify if nginx is running after deployment.

Command: systemctl restart nginx


Purpose: Restart a service
Real-World Use Case: Apply configuration changes.

Command: systemctl reload nginx


Purpose: Reload config without restart
Real-World Use Case: Update nginx config with minimal downtime.

Command: systemctl enable nginx


Purpose: Start service at boot
Real-World Use Case: Ensure service survives server reboot.

Command: systemctl list-units --state=failed


Purpose: List failed services
Real-World Use Case: Quick troubleshooting after outages.

journalctl
Command: journalctl -f
Purpose: Follow live logs
Real-World Use Case: Monitor logs during deployment.

Command: journalctl -u nginx


Purpose: Show service logs
Real-World Use Case: Investigate nginx startup failures.

Command: journalctl -p err


Purpose: Show only errors
Real-World Use Case: Focus on critical issues.

Command: journalctl --since today


Purpose: Logs from today
Real-World Use Case: Review today's incidents.

cron
Command: crontab -e
Purpose: Edit cron jobs
Real-World Use Case: Schedule backups and maintenance tasks.

Command: crontab -l
Purpose: List cron jobs
Real-World Use Case: Verify scheduled tasks.

Command: 0 2 * * * [Link]
Purpose: Run daily at 2 AM
Real-World Use Case: Nightly database backups.

ps
Command: ps aux
Purpose: List all processes
Real-World Use Case: Find resource-hungry applications.

Command: ps aux --sort=-%cpu


Purpose: Sort by CPU usage
Real-World Use Case: Identify CPU bottlenecks.

Command: ps -ef | grep nginx


Purpose: Find specific process
Real-World Use Case: Verify nginx process is running.

top
Command: top
Purpose: Real-time process monitoring
Real-World Use Case: Monitor server performance.

Command: M
Purpose: Sort by memory
Real-World Use Case: Find memory-consuming processes.

Command: P
Purpose: Sort by CPU
Real-World Use Case: Find CPU-intensive processes.

ss
Command: ss -tulnp
Purpose: Show listening ports
Real-World Use Case: Check which services are listening.
Command: ss -tulnp | grep :80
Purpose: Check port 80
Real-World Use Case: Verify web server binding.

Command: ss -s
Purpose: Connection summary
Real-World Use Case: Analyze network usage.

find
Command: find / -type f
Purpose: Find files
Real-World Use Case: Search configuration or log files.

Command: find /etc -name '*.conf'


Purpose: Find config files
Real-World Use Case: Locate application configs.

Command: find / -size +100M


Purpose: Find large files
Real-World Use Case: Investigate disk space issues.

grep
Command: grep -i error [Link]
Purpose: Search errors
Real-World Use Case: Troubleshoot application failures.

Command: grep -C 3 error [Link]


Purpose: Show context around matches
Real-World Use Case: Analyze surrounding log entries.

Command: grep 'Failed password' [Link]


Purpose: Find failed logins
Real-World Use Case: Security investigation.

You might also like