Linux server command guide
This guide organizes common Linux administration commands into six practical areas: filesystem navigation, file management, users and permissions, processes and monitoring, system operation, and networking.
Filesystem navigation
pwd
Show current directory.
ls -la
List files including hidden entries.
cd /path
Change directory.
find /path -name "file"
Search for a matching path.
Files and directories
touch file
Create a file or update its timestamp.
mkdir -p path
Create directories including parents.
cp source destination
Copy data.
mv old new
Move or rename.
rm file
Remove a file.
Be especially careful with recursive deletion and elevated privileges.
Users and permissions
whoami
Show current user.
id
Show user and group IDs.
chmod 640 file
Change permission bits.
chown user:group file
Change ownership.
sudo command
Run with elevated privileges when allowed.
Processes and resources
ps aux
List processes.
top
Live process/resource view.
free -h
Memory information.
df -h
Filesystem capacity.
du -sh path
Directory size estimate.
uptime
Uptime and load information.
Services and logs
systemctl status SERVICE
Inspect a systemd service.
systemctl restart SERVICE
Restart a service.
journalctl -u SERVICE
Read service logs.
Check logs before restarting a failed service. Restarting can remove the immediate symptom without fixing the root cause.
Networking
ip addr
View interfaces and addresses.
ip route
View routing.
ping HOST
Basic reachability test.
ss -tulpn
Inspect listening sockets.
curl -I URL
Inspect HTTP headers.
dig DOMAIN
Query DNS.
Practical troubleshooting order
- Confirm the exact symptom.
- Check service status.
- Read recent logs.
- Check CPU, RAM and disk.
- Check ports and routes.
- Verify DNS when relevant.
- Review configuration and permissions.
- Make one controlled change.
- Re-test and document the result.
A safer Linux administration workflow
Commands are most useful when they are part of a repeatable troubleshooting process. Start by observing the system, narrow the problem, make the smallest necessary change, and verify the result before continuing.
- Identify: confirm the host, user, current directory and affected service.
- Observe: inspect resource usage, service state, logs, listening ports and storage before changing configuration.
- Change carefully: back up important configuration and avoid destructive commands unless their effect is understood.
- Verify: re-check service status, logs and connectivity after the change.
- Document: record the command and configuration change for future recovery.
Linux troubleshooting flow
Service not starting
Check the service status first, then inspect recent logs and validate its configuration.
Port unreachable
Confirm the process is listening, then check local firewall rules, network addressing and upstream controls.
Disk full
Check filesystem usage, then identify large directories and logs before deleting anything.
High load
Inspect CPU, memory, process activity and I/O to determine which resource is actually constrained.
Linux administration model
Linux server administration becomes easier when commands are grouped by the problem being solved: navigating the filesystem, managing files, controlling users and permissions, observing processes, managing services, checking storage and diagnosing networking. The goal is not to memorize hundreds of commands; it is to know what information to collect and how to change the system safely.
Filesystem and file-management essentials
pwd ls -la cd /path mkdir -p /path/to/dir cp source destination mv source destination rm file find /var/log -type f -name '*.log'
Use destructive commands carefully. Confirm the working directory and target path before recursive operations. For important data, prefer a tested backup or versioned workflow over irreversible manual deletion.
Users, groups and permissions
id whoami getent passwd getent group chmod 640 file chown user:group file sudo -l
Linux permissions are part of the security model. Use least privilege, avoid sharing administrator credentials, and grant services only the access they actually require.
Processes, memory and system health
ps aux top free -h df -h du -sh /var/* uptime systemctl --failed
When diagnosing performance, compare CPU usage, memory availability, load, filesystem capacity and I/O symptoms rather than relying on one metric.
Services, logs and networking
systemctl status nginx journalctl -u nginx --since today ss -tulpn ip addr ip route ping 1.1.1.1 curl -I https://example.com resolvectl status
These commands help determine whether a service is running, whether it is listening on the expected interface and whether the server can reach required network destinations. Adapt commands to the distribution and service manager in use.
A safe Linux troubleshooting sequence
- Define the symptom and when it started.
- Check whether the problem affects one service or the whole server.
- Check CPU, memory, disk space and I/O.
- Inspect service status and relevant logs.
- Check listening ports, routes and DNS when networking is involved.
- Change one variable at a time where possible.
- Record the fix and the evidence that confirmed it.
Linux command safety notes
Commands such as
rm -rf
, recursive permission changes and network configuration changes can cause outages or data loss. Read command documentation, verify paths and understand the effect before running privileged operations. The examples on this page are educational references, not a substitute for reviewing your distribution's documentation.
Turning command output into a diagnosis
Commands are most useful when their output answers a specific question. If an application is slow, first establish whether the host is CPU-bound, memory-bound, I/O-bound or waiting on an external service. If a web service is unreachable, check whether the process is running, whether the expected port is listening, whether the local firewall permits it and whether the network path reaches the host.
Keep a small record of commands and observations during incidents. This reduces repeated work and makes it easier to hand a problem to another administrator. Avoid changing several unrelated settings at once because doing so can remove the evidence needed to identify the original cause.