KwickAcademy Course Topics · 6 min · free
Elementary system administration scripts
Write simple system administration scripts: date, who, df -h, free -h, uptime, command substitution, a disk warning, user check, backup and cleanup. $(command) runs a command and puts its result into the script.
Follows the syllabus of: GSEB Std 11 Computer Studies
On screen in this lesson
What is system administration?
| Keeping a computer system healthy and safe |
| Checking disk space and memory |
| Managing users who log in |
| Taking backups and cleaning old files |
Useful admin commands
| Command | Shows | Example |
|---|---|---|
| date | date and time | date |
| whoami, who | users | who |
| df -h | disk space | df -h |
| free -h | memory (RAM) | free -h |
| uptime | running time | uptime |
Command substitution
| $( command ) runs the command first |
| Its result is put in that place |
| Example: today=$(date) |
Pause and predict
| If used is 80, what prints? |
| Nothing: 80 -gt 80 is false |
| Use -ge to include 80 |
Safety rules
| Test first on a practice folder |
| Print before you delete |
| Use sudo only when it is really needed |
| Keep a backup before big changes |
Quick recap
| System admin: keep the computer healthy and safe |
| date, who, df -h, free -h, uptime give system facts |
| $(command) puts a command's result in a script |
| if can warn when disk space is low |
| tar makes backups; find -mtime cleans old files |
Quick answers
used=80 and the test is -gt 80. What prints?
Nothing, because 80 -gt 80 is false. Use -ge.
Which command shows disk space?
df -h.
KwickClips from this lesson
Short clips, one idea each. Good for revision the night before.
The full lesson, in text
Hello students, welcome to Kwickprep. Who checks that the computers in your school lab have enough disk space and a safe backup? That person is the system administrator. Today we will write small scripts that do these daily checks in seconds.
First, a new term. System administration means looking after a computer system so it runs smoothly and safely. It includes checking disk space and memory. It includes managing the users who log in. It includes taking backups, which are safe copies of important files. It also includes cleaning up old files that waste space.
Scripts for admin work use a few simple commands. The date command shows the current date and time. The whoami command shows your own user name, and who shows everyone logged in. The df command, with -h, shows free disk space in easy units like GB. The free command, with -h, shows memory. The uptime command shows how long the computer has been running.
Here is a system report script. Each echo prints a heading, and the next command prints the details. Hostname prints the name of the computer. Df -h with a slash shows the space on the main disk. The output changes from computer to computer, so there is no fixed answer here.
That script used a new idea, called command substitution. We write a command inside dollar and round brackets. The shell runs that command first. Then it puts the result in its place. So today equals dollar, bracket, date, bracket stores the date in a variable called today.
Now a script that makes a decision. In real life, the first line would read the disk usage with df, but we fix it at eighty five to see the logic. The if checks whether used is greater than eighty, using -gt. It is, so the script prints the warning. An administrator can run this every morning.
Pause and predict before the answer. If used is exactly eighty, the test -gt eighty is false, because eighty is not greater than eighty. So nothing prints at all. If you want eighty to warn too, change -gt to -ge. Always test the edge value in admin scripts.
Administrators often check whether a user account exists. The id command prints details of a user, and fails if there is no such user. The part with the greater than sign sends normal messages to dev null, a bin that throws them away. Two greater than and one sends error messages there too. If id succeeds, the script prints that riya exists. Otherwise it prints No such user.
A backup is a safe copy of files. The tar command packs a whole folder into one archive file. Minus c creates, minus z compresses, and minus f names the file. We add today's date to the file name, so every day gets its own backup. First the script moves to the home folder with cd, and mkdir -p makes the backups folder if it is missing. Then it packs the Documents folder into it.
Old temporary files waste disk space. The script makes sure the tmp folder exists, then moves into it, and double pipe exit stops the script if that fails. The find command searches it, and the dot means this folder. Name star dot log picks every log file. Hyphen m time plus seven means the file changed more than seven days ago. Run find alone first to see the list, then add hyphen delete to remove them.
Admin scripts are powerful, so follow four safety rules. Test a script first on a practice folder. Print what will be deleted before deleting anything. Use sudo, which runs a command as the super user, only when truly needed. And always keep a backup before a script changes important files.
Let us revise what we learned today. System administration keeps a computer healthy and safe. Date, who, df, free and uptime give quick system facts. Dollar with round brackets puts a command's result into a script. With if, a script can warn when the disk is almost full. Tar makes backups, and find with hyphen m time cleans old files carefully.
Courses that teach this
| Course | Unit |
|---|---|
| GSEB Std 11 Computer Studies | Advanced Scripting |
Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.
Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.


![Code: used=85, if [ $used -gt 80 ], echo Disk almost full.](/images/learn/clips/CS-G-041-R1.webp)