System Administration

20 Linux Administration Tips and Tricks

Comprehensive guide covering 20 essential Linux administration tips and tricks for DevOps professionals. Learn command line mastery, security best practices, scripting, containerization, cloud services, CI/CD, monitoring, and career certifications.

#linux #devops #sysadmin #career #tips #best-practices #automation #security
Sign In to Download

Free account required

πŸ’‘

Excel in Your DevOps Career

Linux administration is the backbone of modern DevOps practices. These 20 essential tips and tricks will help you master the command line, implement security best practices, automate workflows, and leverage cutting-edge tools like Docker, Kubernetes, and cloud platforms. Start your DevOps journey by choosing the right infrastructure from our VPS providers, compare performance, and monitor your systems.

Whether you're just starting out or looking to level up your skills, this comprehensive guide covers everything from basic command-line operations to advanced DevOps automation and infrastructure management. Test these practices on reliable benchmarked VPS hosting.

Linux Fundamentals

1

Master the Command Line

Get comfortable with the Linux command line. The command line is your Swiss Army knife for DevOps tasks. Learn basic commands like ls, cd, cp, mv, cat, and echo.

# Navigate and list files
$ ls -lah
$ cd /var/log
$ pwd

# File operations
$ cp file.txt backup.txt
$ mv oldname.txt newname.txt
$ cat file.txt | grep "error"

πŸ’‘ See our Linux Commands Cheatsheet for comprehensive reference

2

File Permissions

Understand file permissions (chmod, chown) and managing access control is crucial in a DevOps role. Properly configuring permissions ensures security and proper application functionality.

# Change file permissions
$ chmod 755 script.sh        # rwxr-xr-x
$ chmod u+x script.sh        # Add execute for user

# Change ownership
$ sudo chown user:group file.txt
$ sudo chown -R www-data:www-data /var/www/

πŸ“š Learn more: Linux File Permissions Cheatsheet

3

SSH Key Pairs

Generate SSH key pairs for secure server access. Use ssh-agent to manage keys and never store private keys in plain text.

# Generate SSH key pair
$ ssh-keygen -t ed25519 -C "[email protected]"

# Copy public key to server
$ ssh-copy-id user@hostname

# Use ssh-agent for key management
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_ed25519

πŸ”’ Security guide: OpenSSH Server Hardening

4

Firewall Rules

Learn iptables or use firewalld to control network traffic. Properly configuring firewalls is vital for server security.

# Using firewalld (modern approach)
$ sudo firewall-cmd --list-all
$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --permanent --add-port=8080/tcp
$ sudo firewall-cmd --reload

# Using iptables (legacy)
$ sudo iptables -L -n -v
$ sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

πŸ›‘οΈ Full guide: Linux Server Hardening Cheatsheet
πŸ” Test your firewall: Port Scanner to verify open ports and firewall configuration

5

Take Regular Backups

Set up automated backups using tools like rsync or tar. Regular backups can save your data and configurations from disasters.

# Using rsync for incremental backups
$ rsync -avz --delete /source/ /backup/
$ rsync -avz -e ssh /local/path/ user@remote:/backup/

# Using tar for compressed backups
$ tar -czf backup-$(date +%Y%m%d).tar.gz /path/to/data/

# Automate with cron (daily at 2 AM)
$ crontab -e
0 2 * * * /usr/local/bin/backup-script.sh

⏰ Automation: Cron Job Cheatsheet | πŸ“¦ Archiving: TAR Command Cheatsheet

Automation & Scripting

6

Scripting Skills

Become proficient in Bash or Python scripting to automate repetitive tasks. This is the heart of DevOps automation.

#!/bin/bash
# Simple backup script
DATE=$(date +%Y%m%d)
BACKUP_DIR="/backup"
SOURCE="/var/www"

# Create backup
tar -czf "$BACKUP_DIR/backup-$DATE.tar.gz" "$SOURCE"

# Keep only last 7 days of backups
find "$BACKUP_DIR" -name "backup-*.tar.gz" -mtime +7 -delete

echo "Backup completed: backup-$DATE.tar.gz"

Pro Tip: Start with simple scripts and gradually add error handling, logging, and notifications. Version control your scripts with Git!

7

Package Management

Know your package manager (apt, yum, dnf). Keep software up to date and resolve dependencies efficiently.

# Debian/Ubuntu
$ sudo apt update && sudo apt upgrade -y
$ sudo apt install nginx -y

# RHEL/CentOS/Fedora
$ sudo dnf update -y
$ sudo dnf install nginx -y

# Search for packages
$ apt search nginx
$ dnf search nginx
8

Network Troubleshooting

Learn iptables or use firewalld to control network traffic. Master networking commands for diagnosing issues.

# Check connectivity
$ ping -c 4 google.com
$ traceroute google.com

# Check open ports and connections
$ ss -tuln
$ netstat -tuln

# DNS troubleshooting
$ nslookup example.com
$ dig example.com

# Check routing table
$ ip route show

🌐 More commands: Linux Networking Commands | IP Command Reference
πŸ› οΈ Diagnostic tools: DNS Lookup for DNS troubleshooting | WHOIS for domain info | What Is My IP to check your server's public IP

9

Process Management

Use commands like ps, top, and systemctl to monitor and manage processes. Keep an eye on server performance.

# View running processes
$ ps aux
$ ps aux | grep nginx
$ top
$ htop

# Manage services with systemctl
$ sudo systemctl status nginx
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
$ sudo systemctl restart nginx

# Kill processes
$ kill -9 1234
$ killall nginx
10

Disk Management

Master commands like df and du to manage disk space. Use LVM for flexible storage management.

# Check disk space
$ df -h
$ df -i  # Check inodes

# Check directory sizes
$ du -sh /var/log
$ du -h --max-depth=1 /var | sort -hr

# Find large files
$ find / -type f -size +100M 2>/dev/null

# Check disk I/O
$ iostat
$ iotop

πŸ’Ύ Advanced: Linux LVM Cheatsheet

Modern DevOps Tools & Practices

11

Version Control

Get comfortable with Git for tracking changes to your code and configurations. Git is essential for collaboration.

# Initialize repository
$ git init
$ git clone https://github.com/user/repo.git

# Basic workflow
$ git status
$ git add .
$ git commit -m "Add new feature"
$ git push origin main

# Branching
$ git checkout -b feature-branch
$ git merge feature-branch

πŸ“– Complete guide: Git Command Cheatsheet

12

Containerization

Explore Docker and container orchestration tools like Kubernetes. Containers simplify deployment and scaling.

# Docker basics
$ docker run -d -p 80:80 nginx
$ docker ps
$ docker images
$ docker logs container_id
$ docker exec -it container_id bash

# Build custom image
$ docker build -t myapp:latest .
$ docker push myapp:latest

# Docker Compose
$ docker-compose up -d
$ docker-compose logs -f

🐳 Learn more: Docker Reference Sheet | ☸️ Kubernetes Components
πŸ—οΈ Container hosting: Container-optimized VPS providers | Docker performance benchmarks

13

Configuration Management

Learn tools like Ansible, Puppet, or Chef to automate server configuration and ensure consistency.

# Ansible example - playbook.yml
---
- hosts: webservers
  become: yes
  tasks:
    - name: Install nginx
      apt:
        name: nginx
        state: present
        update_cache: yes
    
    - name: Start nginx service
      service:
        name: nginx
        state: started
        enabled: yes

# Run playbook
$ ansible-playbook -i inventory.ini playbook.yml
14

Cloud Services

Familiarize yourself with cloud providers like AWS, Azure, or GCP. Infrastructure as Code (IaC) is a game-changer.

AWS CLI
$ aws s3 ls
$ aws ec2 describe-instances
Azure CLI
$ az vm list
$ az group create
GCP gcloud
$ gcloud compute instances list
$ gcloud projects list

☁️ Cloud models: Cloud Platform Models
🏒 Choose hosting: Compare VPS providers | Side-by-side comparison | Cloud VPS performance benchmarks

15

Testing & CI/CD

Integrate testing into your DevOps pipelines. Use Jenkins, Travis CI, or GitLab CI for continuous integration and delivery.

# Example .gitlab-ci.yml
stages:
  - build
  - test
  - deploy

build_job:
  stage: build
  script:
    - docker build -t myapp:$CI_COMMIT_SHA .
    - docker push myapp:$CI_COMMIT_SHA

test_job:
  stage: test
  script:
    - pytest tests/

deploy_job:
  stage: deploy
  script:
    - kubectl set image deployment/myapp myapp=myapp:$CI_COMMIT_SHA
  only:
    - main
16

Monitoring & Logging

Implement monitoring with tools like Prometheus, Grafana, or Nagios. Centralized logging (ELK stack) helps troubleshoot issues.

Monitoring Tools

  • β€’ Prometheus - Metrics collection
  • β€’ Grafana - Visualization dashboards
  • β€’ Nagios - Infrastructure monitoring
  • β€’ Datadog - Cloud monitoring

Logging Tools

  • β€’ ELK Stack - Elasticsearch, Logstash, Kibana
  • β€’ Fluentd - Log aggregation
  • β€’ Loki - Log aggregation by Grafana
  • β€’ Splunk - Enterprise logging

πŸ“Š Log parsing: Linux Log Parsing Commands
πŸ“ˆ Monitor your infrastructure: Dashboard for real-time metrics | Performance benchmarks to track VPS health

Career & Professional Growth

17

Infrastructure as Code

Write infrastructure code with Terraform or CloudFormation to automate provisioning and scaling of resources.

# Terraform example - main.tf
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t2.micro"

  tags = {
    Name = "WebServer"
  }
}

# Commands
$ terraform init
$ terraform plan
$ terraform apply
18

Automation & Orchestration

Use tools like Kubernetes, Docker Swarm, or Apache Mesos for container orchestration. Automation streamlines tasks.

# Kubernetes deployment
$ kubectl create deployment nginx --image=nginx
$ kubectl expose deployment nginx --port=80 --type=LoadBalancer
$ kubectl scale deployment nginx --replicas=3
$ kubectl get pods
$ kubectl logs pod-name
$ kubectl describe deployment nginx

☸️ Deep dive: Kubernetes Components Cheatsheet

19

Certifications

Consider certifications like Linux+, Certified Kubernetes Administrator (CKA), or Red Hat Certified Engineer (RHCE) to validate your skills.

Linux Certifications

  • 🎯 CompTIA Linux+ - Entry level
  • πŸ”΄ RHCSA - Red Hat Certified System Administrator
  • πŸ”΄ RHCE - Red Hat Certified Engineer
  • 🐧 LFCS - Linux Foundation Certified SysAdmin

DevOps Certifications

  • ☸️ CKA - Certified Kubernetes Administrator
  • ☸️ CKAD - Certified Kubernetes App Developer
  • ☁️ AWS DevOps Engineer - Professional
  • ☁️ Azure DevOps Engineer - Expert
20

Continuous Learning

Stay updated with the ever-evolving DevOps landscape. Attend conferences, read blogs, and keep experimenting to excel in your career.

Learning Resources

πŸ“š Blogs & News:
  • β€’ Dev.to, Medium, Hacker News
  • β€’ DevOps.com, The New Stack
  • β€’ Official tech blogs (AWS, Google Cloud)
πŸŽ“ Learning Platforms:
  • β€’ Udemy, Coursera, Pluralsight
  • β€’ A Cloud Guru, Linux Academy
  • β€’ KodeKloud for hands-on labs
🀝 Communities:
  • β€’ DevOps subreddit
  • β€’ CNCF Slack channels
  • β€’ Local meetups and conferences
πŸ§ͺ Practice:
  • β€’ GitHub open source projects
  • β€’ Home lab setup
  • β€’ Cloud free tiers (AWS, GCP, Azure)

Ready to Put Your Skills to Work?

Practice these Linux administration tips on powerful VPS hosting. Compare VPS providers, explore side-by-side comparisons, discover helpful DevOps tools, and learn from our server types guide to find the perfect environment for your DevOps projects.

Contact Us β€’ About Us β€’ Privacy Policy β€’ Dashboard