Essential Linux commands streamline daily tasks for DevOps, backend development, AI/ML workflows, and server management. These commands enable efficient navigation, monitoring, automation, and troubleshooting across Linux environments used in cloud deployments, container orchestration, and data pipelines. Mastering them boosts productivity for IT professionals handling Golang apps, AWS/GCP instances, PostgreSQL databases, and ML model training.
File Management
Commands for creating, copying, moving, and deleting files/directories form the foundation of deployments and data handling.
ls -la: Lists all files (including hidden) with detailed permissions, ownership, and sizes.cd /path: Changes to the specified directory; usecd ~for home orcd -to return to previous.pwd: Prints the current working directory path.mkdir -p /new/dir: Creates directories recursively, handling nested paths.touch file.txt: Creates an empty file or updates timestamps.cp -r source/ dest/: Copies files or directories recursively.mv source dest: Moves or renames files/directories.rm -rf dir: Removes files/directories forcefully (use cautiously in production).
Process Monitoring
Track running services, containers, and resource usage critical for debugging backend services or ML training jobs.
ps aux | grep process: Lists processes with details, filtering by name (e.g.,nginxorpython).toporhtop: Interactive real-time view of CPU/memory usage; quit withq.kill -9 PID: Terminates a process by PID (find PID viaps).pkill -f pattern: Kills processes matching a name or pattern.
Service Control
Manage systemd services like Docker, Nginx, or databases on AWS EC2/RDS instances.
systemctl status service: Checks if a service (e.g.,docker,nginx) is running.systemctl start/stop/restart service: Controls service lifecycle.systemctl --failed: Lists failed services for quick diagnostics.
Log Analysis
Essential for troubleshooting errors in DevOps pipelines, API logs, or AI training outputs.
tail -f /var/log/app.log: Follows log file in real-time.grep "ERROR" /var/log/*.log: Searches for patterns across logs.journalctl -u service -f: Streams logs for a specific systemd service.
Networking
Diagnose connectivity for backend APIs, cloud VPCs, or remote ML data access.
ping host: Tests network reachability.netstat -tulnporss -tulnp: Shows listening ports and processes.curl -I url: Fetches HTTP headers for API health checks.
Disk and Package Management
Monitor storage for databases/PostgreSQL and install tools like Golang or AWS CLI.
df -h: Human-readable disk usage summary.du -sh /path: Summarizes directory size.apt update && apt install package(Debian/Ubuntu) oryum install package(RHEL).
Automation Tools
Schedule backups or sync code deployments across servers.
crontab -e: Edits cron jobs for tasks like daily RDS backups.rsync -avz source/ user@remote:/dest/: Synchronizes files securely over SSH.
Add comment