AWS Builder Center
Troubleshooting Linux in the Cloud: 4 Classic Commands That Save the Day on AWS EC2

Troubleshooting Linux in the Cloud: 4 Classic Commands That Save the Day on AWS EC2

Learn how four classic Linux commands (lsblk, ss, journalctl, and namei) help you quickly diagnose storage, network, service, and permission issues on AWS EC2.

When transitioning from local virtual machines to the cloud, it is easy to get overwhelmed by dozens of new service names. Yet, the moment you connect to an Amazon EC2 instance, you are back on familiar ground: a Linux terminal.

Cloud platforms abstract the physical hardware, but understanding how the operating system behaves underneath is what separates someone who simply launches servers from someone who can reliably troubleshoot them. Here are four classic Linux commands that remain essential when managing workloads on AWS.

1. Inspecting Block Devices and Filesystems ( lsblk  and  df -h )
On AWS, increasing the size of an Amazon EBS volume in the console only expands the underlying virtual disk. Inside the operating system, the partition and filesystem still need to claim that new space.
  • Running  lsblk  displays the exact hierarchy of block devices and partitions (such as  nvme0n1  and  nvme0n1p1 ).
  • Running  df -h  shows actual mounted disk usage in human-readable format.
Together with  growpart  and  resize2fs  (or  xfs_growfs ), these commands allow you to expand storage on a live Linux instance without downtime.


2. Verifying Listening Sockets Before Touching Firewalls ( ss -tulnp )

When an application hosted on EC2 fails to respond, it is common to spend hours inspecting AWS Security Groups, Route Tables, and Network ACLs. Before debugging cloud networking, check what is happening inside the OS with:

ss -tulnp
This lists all active TCP/UDP listening ports and the processes bound to them. If your web server is listening only on  127.0.0.1  instead of  0.0.0.0 —or if the daemon crashed—no cloud firewall rule will make it reachable.

3. Filtering Service and Boot Logs ( journalctl )

Most modern Linux distributions on AWS rely on  systemd , making  journalctl  indispensable during incidents. Instead of digging manually through multiple log files, you can filter events by service, priority, or boot cycle:

journalctl -u nginx --since "15 minutes ago"
journalctl -p err -b

This quickly exposes misconfigured unit files, permission denials, or  cloud-init  bootstrap errors right after an instance initializes.

4. Checking the Entire Path Permission Chain ( namei -l )

Deployment scripts and web services frequently break due to a single restrictive parent directory. Checking just the target file with  ls -l  is often not enough. Running:

namei -l /var/www/html/index.html

Shows the ownership and permissions of every directory along the path, making it immediately obvious if a service user lacks execute ( +x ) traversal permissions on an upper folder.

Final Thoughts

Cloud computing transforms racks, switches, and cables into API calls, making infrastructure faster and more scalable than ever. Still, strong Linux fundamentals remain one of the highest-leverage skills any builder can develop.

What is the first Linux command you run when debugging a newly launched server?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article