Skip to main content

Master Linux Administration for DevOps: Powerful Commands, Troubleshooting Tips & Best Practices

Linux administration is one of the most important skills for anyone working in DevOps. From application servers and CI/CD platforms to containers and cloud infrastructure, Linux-based systems are widely used in modern technology environments.

In my day-to-day DevOps activities, I regularly work with Linux commands to manage files, monitor processes, troubleshoot services, investigate network problems, analyze logs, and resolve production issues.

This guide covers essential Linux administration concepts and commands that are useful for DevOps engineers, along with practical examples of how they can be applied during everyday troubleshooting.

1. Understanding Linux File Permissions

Linux uses a permission system to control access to files and directories. The three basic permissions are:

  • Read (r) – Allows a user to view the contents of a file or directory.
  • Write (w) – Allows modifications to a file or directory.
  • Execute (x) – Allows a file to be executed or a directory to be accessed.

These permissions can be assigned to three categories:

  • Owner
  • Group
  • Others

Some Linux commands I frequently use for managing permissions and ownership include:

ls -l 
chmod
chown

For example, if a deployment script does not have execute permission, I can make it executable using:

chmod +x deploy.sh

The chown command is useful when a file or directory needs to be assigned to a different user or group.

Understanding Linux permissions is especially important when working with application deployments, automation scripts, configuration files, and service accounts.

2. Linux Process Management

Process management is another essential part of Linux administration. When an application behaves unexpectedly or consumes excessive system resources, identifying the relevant process is often one of the first troubleshooting steps.

Common process management commands include:

ps -ef 
top
htop
pgrep
kill
kill -9

For example, if CPU utilization suddenly increases, I can use top or htop to identify processes consuming significant resources. After finding the process ID, I investigate what the application is doing before taking corrective action.

I generally avoid using kill -9 as the first option. A normal kill signal gives the application an opportunity to shut down gracefully. A forceful termination should be reserved for situations where the process does not respond appropriately.

3. Managing Linux Services with Systemd

Modern Linux distributions commonly use systemd to manage background services.

During application deployment and troubleshooting, I frequently work with the systemctl command.

systemctl status nginx 
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl enable nginx

These commands allow me to check a service's current status, start or stop it, restart it, or configure it to start automatically when the system boots.

When a service fails to start, checking its status is usually a good starting point.

I also use journalctl to examine service-related logs:

journalctl -u nginx

Combining systemctl with journalctl makes service troubleshooting easier because I can review both the service state and the associated log messages.

4. Linux Networking Commands for DevOps

Networking knowledge is extremely valuable in DevOps because many application problems are related to connectivity, DNS, routing, ports, or firewall configuration.

Some commonly used Linux networking commands include:

ip addr 
ip route
ping
curl
ss
netstat
nslookup
dig
traceroute

Each command provides different information. For example, ip addr helps inspect network interfaces, while ip route displays routing information. Commands such as nslookup and dig are useful for checking DNS resolution.

If an application cannot connect to another service, I troubleshoot the problem systematically by checking:

  1. DNS resolution
  2. Network routes
  3. Firewall configuration
  4. Destination server availability
  5. Listening ports
  6. Application configuration

The following command is particularly useful for checking listening TCP ports:

ss -lntp

It can help identify whether the expected service is listening and, depending on permissions and system configuration, which process is associated with the listening socket.

5. Linux Package Management

Package managers simplify the installation, updating, and removal of software on Linux servers.

On Amazon Linux and Red Hat-based distributions, I commonly work with:

yum 
dnf

On Ubuntu and Debian-based systems, apt is widely used.

apt

For example, installing Nginx with DNF can be done using:

sudo dnf install nginx

On an Ubuntu or Debian-based system, the equivalent command is:

sudo apt install nginx

Package management is useful during server provisioning, application setup, dependency installation, and troubleshooting missing software components.

Before installing or updating packages on important environments, I also consider compatibility, package versions, repository configuration, and the possible impact on existing applications.

6. Monitoring CPU, Memory, Disk, and System Load

System monitoring is an important part of Linux administration. When a server becomes slow or an application starts responding slowly, I first gather information about the system's current resource usage.

Some useful commands include:

top 
free -m
df -h
du -sh
uptime
vmstat
iostat

These commands help investigate different areas of system performance:

  • top helps monitor processes and CPU usage.
  • free -m displays memory utilization.
  • df -h shows filesystem usage.
  • du -sh helps identify the size of directories.
  • uptime displays system uptime and load information.
  • vmstat provides information about system performance.
  • iostat can help analyze CPU and storage I/O activity.

If a server is performing slowly, I avoid making assumptions. Instead, I collect CPU, memory, disk, and load information to narrow down the possible bottleneck.

7. Log Analysis and Troubleshooting

Logs are one of the most valuable sources of information during application and infrastructure troubleshooting.

I commonly use commands such as:

tail -f application.log 
grep "ERROR" application.log
less application.log
journalctl

For example, the following command can help locate error-related entries:

grep -i "error" app.log

I may also use tail -f when I need to observe new log entries while an application is running.

Instead of checking logs randomly, I usually start by identifying the approximate time of the incident and then search for relevant errors, warnings, request failures, or service events.

This approach makes log analysis more efficient and helps connect application behavior with system-level events.

8. Handling Common Production Linux Issues

Linux administration becomes especially important when troubleshooting production incidents. A systematic approach helps reduce unnecessary changes and makes it easier to identify the actual root cause.

Disk Space Reaching 100%

One issue I have encountered is a filesystem running out of available disk space.

When disk usage reaches 100%, applications may fail to write logs, temporary files, or other required data. This can lead to unexpected application failures.

I start by checking filesystem usage:

df -h

After identifying the affected filesystem, I use du to investigate which directories are consuming the most space:

du -sh *

Once the source of the problem is identified, I carefully remove or archive unnecessary files according to the organization's retention and operational policies.

After resolving the immediate problem, I also add appropriate monitoring and alerting so that disk usage can be addressed before the filesystem becomes completely full.

High CPU Utilization

Another common issue is unexpectedly high CPU usage.

I typically begin with:

top

This helps identify processes that are consuming significant CPU resources.

I then review application and system logs, examine recent changes, and work with the relevant application or infrastructure team to determine the underlying cause.

Simply terminating a process may temporarily reduce CPU usage, but finding the root cause is important for preventing the problem from returning.

Application Port Already in Use

An application may also fail to start because another process is already using the required port.

I can investigate listening ports with:

ss -lntp

After identifying the process responsible for the port, I determine whether it should be stopped, reconfigured, or whether the application should use another appropriate port.

The goal is to resolve the conflict without unnecessarily affecting other running services.

9. My Practical Linux Troubleshooting Approach

When dealing with a Linux or application issue, I prefer a structured troubleshooting process instead of immediately changing configurations.

My general approach is:

  1. Identify the problem: Understand what is failing and when the issue started.
  2. Collect information: Gather system metrics, service status, network details, and relevant configuration information.
  3. Check logs: Look for errors, warnings, and events related to the incident.
  4. Analyze the evidence: Compare the available information and identify the most likely root cause.
  5. Apply a controlled fix: Make the smallest appropriate change necessary to resolve the issue.
  6. Verify the result: Confirm that the application or service is functioning normally.
  7. Prevent recurrence: Add monitoring, documentation, automation, or configuration improvements where appropriate.

Why Linux Skills Matter for DevOps Engineers

DevOps engineers often work across multiple layers of technology, including applications, operating systems, networking, cloud platforms, containers, and CI/CD systems.

Linux knowledge provides the foundation needed to understand what is happening underneath these technologies.

Knowing commands is useful, but understanding how to interpret their output is even more important. A strong Linux troubleshooting skill set allows DevOps engineers to investigate problems efficiently instead of relying only on trial and error.

Conclusion

Linux administration is a fundamental skill for modern DevOps professionals. File permissions, process management, systemd services, networking, package management, system monitoring, and log analysis are all valuable areas to understand.

In real-world environments, the goal is not simply to memorize Linux commands. The more important skill is learning how to use those commands to collect evidence, identify root causes, apply safe changes, and verify the results.

By combining Linux administration skills with cloud platforms, CI/CD automation, containers, monitoring, and infrastructure as code, DevOps engineers can build a stronger foundation for managing reliable and scalable application environments.

Comments

Popular posts from this blog

A Complete CI/CD Pipeline

Complete CI/CD Pipeline Using GitHub, Jenkins, Maven, SonarQube, Nexus, and Docker A well-designed CI/CD pipeline plays a critical role in modern DevOps practices by automating software delivery, improving code quality, and reducing deployment risks. In this article, I will explain how I build an automated CI/CD pipeline using GitHub, Jenkins, Maven, SonarQube, Nexus Repository, Docker, and Docker Hub. Source Code Management with GitHub The CI/CD workflow begins with storing the application source code in GitHub. Developers regularly push code changes or create pull requests to collaborate on features and bug fixes. Whenever new code is pushed to the repository, GitHub triggers Jenkins automatically through a webhook. This integration helps start the CI/CD pipeline without manual intervention. Code Checkout Stage in Jenkins The first stage of the pipeline is the checkout process. Jenkins connects to the GitHub repository and pulls the latest version of the source code. ...

Terraform for AWS: Step-by-Step Infrastructure Automation That Actually Works

How I Use Terraform to Provision and Manage AWS Infrastructure Efficiently Infrastructure as Code (IaC) has become a critical part of modern cloud operations, and Terraform is one of the most popular tools for automating cloud infrastructure deployment. In this article, I'll share how I use Terraform to build and manage AWS resources such as Virtual Private Clouds (VPCs), EC2 instances, Application Load Balancers (ALBs), and Auto Scaling Groups. Building AWS Infrastructure with Terraform My infrastructure deployment process begins by defining all AWS resources as code. This approach ensures consistency, repeatability, and easier management across multiple environments. The first step is creating a secure network architecture using a VPC. Within the VPC, I configure public and private subnets, route tables, internet gateways, and other networking components required for application deployment. Once the networking layer is ready, I deploy EC2 instances inside private su...