NUnix · L3 MIAGE · CM2 · 90 minutes
ISTIC · University of Rennes
2026–2027
A computer is slow. Would adding RAM help?
Check which resource is under pressure first.
We will use commands to inspect the system, find useful information, and turn it into a summary we can save.
Observe the system → find information → redirect streams → combine commands.
Which programs are running, and where are the resources going?
| Resource | Question | First observation |
|---|---|---|
| CPU | Is computation keeping a processor busy? | top, ps |
| RAM | Is memory pressure affecting the system? | free -h |
| Disk | Can the filesystem store more data? | df -h . |
Adding RAM does not create free space on a full disk.
| Tool | Scope | Question |
|---|---|---|
df |
A filesystem | How much space is available? |
du |
A directory tree | Which directories use space? |
find |
Individual entries | Which files fit my criteria? |
Start broad, then inspect a specific file.
We can inspect CPU, memory and disk usage. Now we need to locate files and find the relevant lines in their contents.
Where is the file, and which lines contain the information we need?
.c files below the current directory.'*.c'?find . -type f -name '*.c'find without expanding it first.We have located a log file. Next, we will search its contents with grep. Save these four lines as app.log:
10:00 INFO STARTED
10:01 ERROR DISK_FULL
10:02 ERROR TIMEOUT
10:03 ERROR DISK_FULL
| Field | Meaning |
|---|---|
| 1 | Time |
| 2 | Severity |
| 3 | Event code |
The editor ed had the command pattern:
g/re/p
grep makes that text search available as a separate command.
We can find files and select useful lines. How can a command read from a file and save its output or errors?
Where does a command read, where does it write, and did it succeed?
Arguments configure the command. Streams carry text. The exit status reports success or failure when the command finishes.
sort names.txt > names.txt
The shell opens and truncates names.txt before starting sort. The input is already gone.
Write to a different file, then inspect the result.
We can choose the input and output of one command. Now we will connect commands to count and rank the errors in our log.
How can one command use another command’s output?
a | b connect?a > out.txt also redirect standard error?>>a's stdout to b's stdin.2> to redirect stderr.find, select lines with grep.More search expressions and interactive process control
| Action | Effect |
|---|---|
| Ctrl+Z | Suspend the foreground job |
bg %1 |
Resume job 1 in the background |
fg %1 |
Resume job 1 in the foreground |
A job number belongs to a shell.
A PID identifies a process in the system.
| Action | Meaning |
|---|---|
kill PID |
Send SIGTERM to a process |
| Ctrl+C | Send SIGINT to the foreground process group |
Ctrl+\ |
Send SIGQUIT to the foreground process group |
| Ctrl+Z | Send SIGTSTP to suspend the foreground group |
| Ctrl+D | Terminal end-of-input action |