A Table That Lines Up
ps output is hard to paste into a ticket. Write /home/student/bin/report.sh FILE, where FILE is a CSV with a header and the columns name,cpu,mem_kb.
Print a table to stdout, with columns separated by exactly one space:
| Column | Width | Alignment | Content |
|---|---|---|---|
NAME | 16 | left | the name, cut to 16 characters if longer |
CPU% | 6 | right | cpu with one decimal |
MEM(MB) | 9 | right | mem_kb / 1024 with one decimal |
The first line is the header (NAME, CPU%, MEM(MB) aligned the same way), then one line per CSV row in file order. For example:
NAME CPU% MEM(MB)
nginx 2.5 120.0
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of Shell Scripting for Automation. Next step: Read One Value From an INI File
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.