System Info and Processes

This guide helps you check system information and running processes on Linux. Each command includes: what it does, how to read the output, and small tips for real work.

Quick map of commands:

Command Purpose Quick memory
uname -a Kernel and system version “Who am I?” (system identity)
df -h Disk space per filesystem “How full are my disks?”
free -h Memory and swap usage “How much RAM is really free?”
uptime Time since boot + load average “How busy is the system?”
ps aux List all processes “What is running now?”
top Live view of CPU/RAM/processes “What is eating resources now?”
kill <PID> Send a signal to a process “Please stop (politely first)!”

uname -a — Kernel and system version

What it shows

uname -a

Linux myhost 6.8.0-39-generic #42-Ubuntu SMP PREEMPT_DYNAMIC x86_64 GNU/Linux

How to read

Why it matters

Tip


df -h — Disk space

What it shows

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       200G  150G   40G  79% /
tmpfs            16G   60M   16G   1% /run
/dev/sdb1       500G  320G  161G  67% /data

Key columns

Common questions

Tips


free -h — Memory usage

What it shows

free -h
              total   used   free  shared  buff/cache  available
Mem:            16G     3G     1G    300M         12G        13G
Swap:            4G   256M     3.8G

Important ideas (simple but deep)

Columns

Swap Used when RAM is not enough. If Swap used grows and the system is slow, you may not have enough RAM for your workload.


uptime — Time since boot & load average

What it shows

uptime

11:20:03 up 5 days,  3:12,  2 users,  load average: 0.85, 1.10, 0.90

Load average (very important)

nproc    # shows number of CPU cores

Processes 101

A process is a running program. Each process has a PID (process ID). There is often a parent process (PPID) that started it.

Why you care:


ps aux — List all processes

What the options mean

$ ps aux | head
USER     PID  %CPU %MEM    VSZ   RSS TTY   STAT START   TIME COMMAND
root       1   0.0  0.1 168324 11000 ?     Ss   Aug09   0:10 /sbin/init
hakob   2123   3.2  1.5 945672 250000 ?    Sl   10:55   1:30 /usr/bin/code
hakob   2301   0.0  0.2 512000  35000 pts/0 Ss+ 10:56   0:00 bash

Columns to know

In short:

ps -eo pid,comm

PID COMMAND
1   systemd
2   kthreadd
3   rcu_gp
4   rcu_par_gp

You can rename columns with =:

ps -o pid=P_ID,comm=COMMAND

P_ID    COMMAND
1156779 bash
1173938 ps

Important: -u has two completely different meanings depending on where you put it.

Combined example

ps -eo user,pid,%cpu,%mem,command

USER       PID %CPU %MEM COMMAND
root         1  0.0  0.1 /sbin/init
hakob     3201  1.2  3.4 java -jar myapp.jar
ps aux | grep java

# Better:
pgrep -a java     # shows matching PIDs and commands

Note: grep will also show itself; pgrep avoids this.


top — Live resource usage

top updates every few seconds and shows the most “hungry” processes.

Header (top lines)

Useful keys inside top

Reading top like a pro (but in simple words)


**kill ** — Stop or control a process (with signals)

kill does not always “kill.” It sends a signal. Some signals ask the app to exit cleanly.

Common signals

kill 12345         # send TERM (15) to PID 12345
kill -15 12345     # same as above
kill -HUP 23456    # ask process to reload (if it supports HUP)
kill -9 34567      # force stop (only if other signals failed)

Safe order to stop a bad process

  1. Try to close the app normally (GUI or Ctrl+C).
  2. kill <PID> (TERM).
  3. kill -9 <PID> only if it will not exit.

Finding the PID first

pgrep -a myapp     # show PID(s) for myapp with command names

Related tools


uname -a        # kernel + system identity
df -h           # disk usage per filesystem
free -h         # memory and swap usage (check 'available')
uptime          # time since boot + load average

ps aux          # list all processes
top             # live CPU/memory/process view
kill <PID>      # send TERM (15) by default; use -9 only last
nproc           # number of CPU cores (for load comparison)