The first ten commands to run on a machine you didn't set up
You are handed a terminal on a server you have never been on. It could be a VM someone else built, a node that came with an inherited cluster, or a box in a rack whose history lives in a ticket nobody can find. Ten commands, in this order, tell you what it is, what shape it's in, and whether anything is already wrong. The whole sequence takes under a minute and every one of them is read only.
Run these in order.
cat /etc/os-release (which
system), uptime (how busy),
df -h (disk space),
free -h (memory pressure),
systemctl --failed (broken
units), ip -br a (its
addresses), ss -tulpn (open
ports), ps sorted by memory
(heaviest processes), journalctl -p err -b
(boot errors) and last (who
logged in).
Every number here is relative to my box and setup, so yours will read differently. The shape of each output is what carries over.
1. What is this machine
Everything else you read is a number without a context until you know which operating system produced it. The package manager, the service manager, the filesystem defaults and the log paths all follow from this one file.
$ grep -E "^(PRETTY_NAME|VERSION_ID)=" /etc/os-release
PRETTY_NAME="Ubuntu 24.04.5 LTS"
VERSION_ID="24.04"
$ uname -srm
Linux 6.8.0-83-generic x86_64
Two facts, both worth having. The distribution tells you which package manager answers and where the logs live, and the architecture line says this box is x86_64, which matters the moment somebody hands you a binary built for ARM and it refuses to run.
2. How long it has been up, and how busy
uptime prints one line that answers two questions. The first is
whether the machine has been restarted recently, which explains a lot of
unexplained state. The second is the load average, three numbers for one, five
and fifteen minutes.
$ uptime
22:57:54 up 12 days, 8:07, 2 users, load average: 0.12, 0.21, 0.21
Twelve days up, and a load under one on every window, which means this box is
mostly idle. Load isn't a percentage. It counts processes that are runnable or stuck in
uninterruptible wait, which is usually disk or NFS I/O, so a hung mount can
raise load while every CPU sits idle. Compare it against
nproc. Four on an eight core machine is half busy, and four on a
single core machine is a queue. Before you blame CPU, look for processes in D
state with ps -eo stat,pid,comm | awk '$1 ~ /^D/'.
3. Is the disk full
df -h is the fastest lie detector on the box. A surprising number
of "the service is broken" tickets are a filesystem at 100 percent, and the
application's error message rarely says so.
$ df -h | head -6
Filesystem Size Used Avail Use% Mounted on
tmpfs 13G 3.0M 13G 1% /run
efivarfs 256K 23K 234K 9% /sys/firmware/efi/efivars
/dev/nvme0n1p2 3.6T 157G 3.3T 5% /
tmpfs 61G 0 61G 0% /dev/shm
tmpfs 5.0M 8.0K 5.0M 1% /run/lock
Read the Use% column and ignore the tmpfs lines, which are memory, not disk.
This box has room. When df
shows a mount at 100 percent, remember that ext4 keeps about five percent of the
blocks for root, so root can still write on a full volume. XFS reserves nothing,
so on RHEL 100 means 100. The next question is what filled it, and that's a
du walk
per directory rather than a guess.
4. Is memory tight
free -h answers with the number people misread most often. The
free column is close to meaningless on Linux, because the kernel fills unused
memory with cache on purpose.
$ free -h
total used free shared buff/cache available
Mem: 121Gi 5.3Gi 78Gi 35Mi 38Gi 116Gi
Swap: 15Gi 0B 15Gi
A hundred and sixteen gigabytes available out of a hundred and twenty one, so
nothing here is under pressure. The column that matters is
available, which the manual defines as the estimate of how much
memory a new process can get without swapping, with the reclaimable part of
the page cache counted in. That's why a box with 2 GB free and 40 GB
available is healthy, and why the low free figure that scares
people is almost always the wrong number. The one to worry about is
available falling toward zero with swap in use, because then the
kernel has run out of pages it can take back.
5. What is already broken
This is the command that finds problems nobody reported. It lists systemd units in a failed state, and on a healthy machine it prints nothing at all.
$ systemctl --failed --no-legend | wc -l
0
Empty output and a count of zero is the good answer, and it's worth saying
out loud because silence looks like a broken command the first time. Don't read
the exit status here. systemctl --failed returns zero whether or not
units are broken, so count the lines instead. On a box
that has been running a while you will usually find one failed unit, and the
name is enough to start the conversation.
6. What address does it have
ip -br a is the short form of the address listing. One line per
interface, up or down, with its addresses.
$ ip -br a | head -6
lo UNKNOWN 127.0.0.1/8 ::1/128
enp1s0 UP 192.168.1.57/24 fe80::1c2d:3e4f:5a6b:7c8d/64
eno2 DOWN
docker0 UP 172.17.0.1/16
br-1a2b3c4d5e6f UP 172.18.0.1/16
tun0 UNKNOWN 10.8.0.6/24
enp1s0 carries the address and eno2 is down, which is
worth knowing before you spend twenty minutes debugging the wrong cable. The
docker0 and br entries are bridges, so containers run
on this host, and tun0 is a VPN tunnel that was up when the capture
was taken. On a server you'd expect a bond or a VLAN over the physical NIC, plus the
bridges and tunnels its workloads need, which is exactly what this host shows.
7. What is listening
ss -tulpn lists TCP and UDP sockets that are waiting for
connections, with the process name where you have permission to see it. This is
how you find the thing occupying the port you need.
$ ss -tulpn | head -6
Netid State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
udp UNCONN 0 0 0.0.0.0:51364 0.0.0.0:*
udp UNCONN 0 0 127.0.0.54:53 0.0.0.0:*
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:*
udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:*
udp UNCONN 0 0 [::]:5353 [::]:*
The process column fills in only for processes your own user can inspect, which
is mostly your own, so rows belonging to anyone else look anonymous.
sudo ss -tulpn fills in the rest. The two entries on 127.0.0.54 and
127.0.0.53 are the local DNS stub, not a service anyone installed.
8. What is eating it
When the load is high or memory looks wrong, sort the process list by whatever you suspect. Memory first, because it's the one that produces an outage with no warning.
$ ps -eo user,pid,%cpu,%mem,vsz,rss,stat,start,time,comm --sort=-%mem | head -6
USER PID %CPU %MEM VSZ RSS STAT STARTED TIME COMMAND
deploy 30627 7.1 0.4 14231336 599796 Sl 22:19:13 01:05:41 hermes
deploy 26531 1.4 0.3 1027596 505956 Ssl 22:14:42 00:13:28 hermes
deploy 2938073 0.3 0.3 10708668 491008 Sl Nov 07 01:01:24 n8n
deploy 3725708 1.2 0.2 818476 344556 Sl 16:33:23 00:16:11 hermes
deploy 693234 0.2 0.2 18449588 315840 Sl 07:02:51 00:00:55 node-MainThread
Sort by -%cpu instead when the load is the symptom. Read the RSS
column rather than VSZ, because VSZ counts memory a process asked for and never
touched. The two numbers rarely tell the same story.
9. What went wrong this boot
The journal holds the errors of the current boot, which is the window that matters when something is failing now.
$ journalctl -p err -b -n 2 --no-pager
Nov 18 06:59:41 node-1 systemd-networkd-wait-online[691354]: Timeout occurred while waiting for network connectivity.
Nov 18 11:41:37 node-1 systemd-networkd-wait-online[974808]: Timeout occurred while waiting for network connectivity.
Priority err means priority three and above, across every source
the journal collects, kernel messages included, so it isn't a syslog view.
On a quiet host that's small enough to read. On a server this is where a disk controller error, an
OOM kill or a failed mount shows up before anyone files a ticket. If it comes back empty on a real machine, check whether
/var/log/journal exists. With the default
Storage=auto the journal keeps only the current boot in memory
until that directory is there, and RHEL creates it at install while Debian,
Ubuntu and most container images leave it out. Don't ask
journalctl --disk-usage, which reports a size either way.
10. Who has been here
The last command answers a question people forget to ask. Sessions, logins, reboots, and from where.
$ last -n 4
deploy pts/0 192.168.1.20 Tue Nov 17 22:12 - 22:15 (00:03)
deploy pts/0 192.168.1.20 Sat Nov 14 10:42 - 10:43 (00:00)
deploy pts/0 192.168.1.20 Sat Nov 14 10:22 - 10:36 (00:13)
deploy pts/0 192.168.1.20 Sat Nov 14 10:11 - 10:13 (00:02)
wtmp begins Tue Nov 04 08:41:07 2026
Same user, same address, four sessions, which is what a normal box looks like. A login from an address you can't place, or a reboot nobody admits to, is the kind of thing this command exists to surface. On a shared machine, read it before you assume you're the only one who has changed anything.
Which one to use, at a glance
Ten commands, one question each.
| Command | Answers | Reach for it when |
|---|---|---|
cat /etc/os-release | Distribution and version | First line on any unknown box |
uptime | Uptime and load average | Something feels slow |
df -h | Space per mounted filesystem | Writes fail or the app errors |
free -h | Memory and swap, including available | The box is swapping or the OOM killer fired |
systemctl --failed | Units in a failed state | A service didn't come back after a restart |
ip -br a | Addresses per interface | You can't reach it |
ss -tulpn | Listening sockets and owners | A port is in use or exposed |
ps sorted by memory | Processes by memory or CPU | Load is high and you want the culprit |
journalctl -p err -b | Errors since boot | Something failed and nobody said why |
last | Logins and reboots | State changed and you want to know who changed it |
Verify it works
Run the whole set on the machine in front of you. Ten lines out, no root, and nothing changed by any of them.
$ grep -E "^PRETTY_NAME=" /etc/os-release; uptime; df -h /; free -h | head -2; systemctl --failed --no-legend | wc -l
PRETTY_NAME="Ubuntu 24.04.5 LTS"
22:57:54 up 12 days, 8:07, 2 users, load average: 0.12, 0.21, 0.21
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p2 3.6T 157G 3.3T 5% /
total used free shared buff/cache available
Mem: 121Gi 4.5Gi 81Gi 26Mi 36Gi 117Gi
0
Read that last number as a sentence. Zero failed units on this box, which is the answer you want on a machine that has been up twelve days.
The honest caveat
Every command in this list has one situation where it answers wrongly, and knowing them is what separates the list from the numbers.
df inside a container reports the overlay filesystem, not the
node's disk, so a pod can read terabytes free and still be killed for filling its
ephemeral storage. uptime's load average counts host processes in
some containers and nothing useful in others. ss without root shows
the sockets and hides the processes, so a port looks ownerless when it's not.
And journalctl prints nothing at all when the journal isn't
persistent, which is the default on plenty of images.
One caveat, and then this is a machine you can trust the answers from. If
what you were handed is a container rather than a machine,
systemctl, ip, ss and
journalctl aren't in a minimal image, and df
reports the container's overlay rather than the node's disk. Run these on
the host.
The boring conclusion
Ten commands, under a minute, and you know what the machine is, whether it's under pressure, what is broken, what is exposed, and who has been on it. The order matters more than the flags, because each answer decides whether the next question is worth asking.
What is the command you run first, before you have read anything else?
Frequently asked questions
What are the first commands to run on a linux server?
Start with the line that names the distribution, then uptime for load, the disk and memory summaries, the failed unit list, the interface addresses, the listening sockets, the process list sorted by memory, the error log since boot, and the login history. None of them change anything on the machine.
What does load average mean in uptime?
It counts processes that are running or waiting for CPU, averaged over one, five and fifteen minutes. Compare it with nproc, so a load of four on an eight core machine is half busy and the same four on a single core machine is a queue.
Why is free memory so low on linux?
The kernel fills unused memory with cache, so the free column looks small on a healthy machine. Read the available column instead, which is what a new process can claim once reclaimable cache is counted.
What does an empty failed unit list mean?
It means no systemd unit is in a failed state, which is the healthy answer. The command prints nothing and exits zero.
Why does ss show no process names?
A normal user can see the sockets but not which program owns them. Run sudo ss -tulpn to get the process column filled in.
Why is journalctl empty?
Storage is probably not persistent, which is the default on many images, so the journal only holds the current boot and sometimes nothing at all. It means logging isn't configured, not that nothing went wrong.
Does df report the real disk inside a container?
No. Inside a container df reports the overlay filesystem, so a pod can show terabytes free and still be killed for filling its ephemeral storage limit. Use findmnt -T / to see what your root actually is, and read the node's disk on the node.
Resources
These are the manuals behind the commands, so the flags behave here the way they behave on your box.
- uptime(1) on man7.org. What the load average counts and the window each number covers.
- ps(1) on man7.org. The sorting and column reference for the process list.
- journalctl(1) on man7.org. Priority filters, boot windows and why storage persistence changes the answer.
When one of these answers needs a deeper look, the next rung is listing block devices with lsblk, then du to find what is big and df to see what is left.