← All articlesLINUX / NETWORKING / DEVOPS TOOLKIT
50 Linux and DevOps commands worth knowing
A quick-reference list grouped by task. Learn what each command shows, adapt placeholders, and check scope before running commands on shared or production systems.
BY MUKESH KUMAR SAH6 MIN READCOMMAND REFERENCE
Use with care: Some commands reveal host, user, process, network, or cluster details. Run them only where authorized, avoid sharing sensitive output, and review flags before adding commands that modify state. Placeholders such as <namespace> are not literal values.
1–8. File and filesystem management
| # | Command | Use |
| 1 | pwd | Print the current working directory. |
| 2 | ls -lah | List files with hidden entries and human-readable sizes. |
| 3 | find ./logs -type f -name '*.log' | Find matching files within a scoped directory. |
| 4 | du -sh ./data | Summarize apparent directory usage. |
| 5 | df -h | Show filesystem capacity and available space. |
| 6 | df -i | Check inode availability when file creation fails. |
| 7 | stat ./config.yaml | Inspect file metadata, timestamps, and permissions. |
| 8 | rsync -avn ./source/ ./backup/ | Preview a directory sync; -n prevents changes. |
9–15. Process and resource management
| # | Command | Use |
| 9 | ps auxf | Inspect processes and parent-child relationships. |
| 10 | top | View live CPU and process activity. |
| 11 | free -h | Check memory and swap summary. |
| 12 | uptime | Check uptime, load averages, and logged-in users. |
| 13 | vmstat 1 5 | Sample CPU, memory, and I/O activity for five intervals. |
| 14 | pgrep -af nginx | Find matching processes and their command lines. |
| 15 | systemctl status nginx | Inspect one systemd service and recent status details. |
16–23. Networking and name resolution
| # | Command | Use |
| 16 | ip addr | Show network interfaces and assigned addresses. |
| 17 | ip route | Inspect the local routing table. |
| 18 | ss -tulpn | List listening TCP/UDP sockets; process details may need privilege. |
| 19 | dig example.com | Query DNS records for a public example domain. |
| 20 | getent hosts service-name | Resolve a name using configured system name services. |
| 21 | curl -I https://example.com | Request response headers from a known endpoint. |
| 22 | traceroute example.com | Trace a route where network policy allows it. |
| 23 | nc -vz host.example 443 | Check TCP connectivity to an authorized host and port. |
24–30. Logs and diagnostics
| # | Command | Use |
| 24 | journalctl -u nginx --since today | Read this service’s journal entries for the current day. |
| 25 | journalctl -p warning -b | Show warning-or-higher journal entries for this boot. |
| 26 | journalctl --disk-usage | Inspect journal storage before cleanup. |
| 27 | tail -n 100 /var/log/syslog | Read the last 100 lines from a common system log path. |
| 28 | grep -i 'error' ./app.log | Search a local log for case-insensitive matches. |
| 29 | dmesg --level=err,warn | Inspect recent kernel warning and error messages. |
| 30 | logrotate --debug /etc/logrotate.conf | Preview logrotate decisions without performing rotation. |
31–36. Identity and security inspection
| # | Command | Use |
| 31 | id | Show the current user and group IDs. |
| 32 | groups | List groups for the current user. |
| 33 | sudo -l | Review the current user’s configured sudo permissions. |
| 34 | namei -l /path/to/file | Inspect permissions along a path’s directory components. |
| 35 | getfacl /path/to/file | Inspect file access-control lists where supported. |
| 36 | sha256sum ./artifact.tar | Calculate a file digest for integrity comparison. |
37–43. Docker operations
| # | Command | Use |
| 37 | docker ps | List running containers. |
| 38 | docker ps -a | List running and stopped containers. |
| 39 | docker images | List local images and their tags. |
| 40 | docker system df | Summarize Docker storage usage. |
| 41 | docker inspect <container> | Inspect one container’s configuration and state. |
| 42 | docker logs --tail 100 <container> | Read the last 100 lines from a container’s logs. |
| 43 | docker stats --no-stream | Take a one-time resource-usage snapshot. |
44–50. Kubernetes operations
| # | Command | Use |
| 44 | kubectl config current-context | Confirm the active cluster context before acting. |
| 45 | kubectl get pods -A -o wide | List pods across namespaces with node placement. |
| 46 | kubectl describe pod <pod> -n <ns> | Inspect one pod’s conditions, events, and configuration. |
| 47 | kubectl logs <pod> -n <ns> --previous | Read logs from the previous container instance. |
| 48 | kubectl get events -n <ns> --sort-by=.lastTimestamp | Review recent events in one namespace. |
| 49 | kubectl top pods -n <ns> | View current pod resource usage if metrics are available. |
| 50 | kubectl rollout status deployment/<name> -n <ns> | Check status of a specific deployment rollout. |
Make commands part of a safe workflow
Commands are most useful when you understand the layer they inspect and the access they require. Check context, scope, and output first. Prefer read-only inspection during initial diagnosis; before any mutating action, confirm the target, owner, expected effect, and recovery path.
Build the troubleshooting habit behind the command.
Continue with the Kubernetes troubleshooting guide, or browse all engineering notes.