An OS is the core software that manages a computer's hardware and lets you run applications.
Linux is a Unix variant: open-source, multi-user. It's the link between the computer and the end user.
| Layer | What it is |
|---|---|
| Kernel | The heart of Linux. Talks directly to hardware: memory management, task scheduling, file management. |
| Shell | Software layer wrapped around the kernel — a command-line interpreter that turns your text commands into something the kernel understands. |
| Command | A specific text instruction typed into the shell. |
| Files & Dirs | All data is organized into files, files into directories, directories into a tree-like filesystem. |
Order to remember: Hardware → Kernel → Shell → Application Programs (bash, ksh, csh, sh, cpp, DBMS...).
| User Type | Prompt | Login allowed? | Typical UID |
|---|---|---|---|
| Root User | # | Yes | 0 |
| Regular User | $ | Yes | 1000+ |
| System User | None | No | 1–999 |
| Command | Meaning |
|---|---|
| pwd | Print current directory path |
| pwd -P | Physical path, resolves symlinks |
| cd folder | Move into folder (relative) |
| cd /a/b | Move using absolute path |
| cd .. | Up one level |
| cd ../.. | Up two levels |
| cd ~ / cd | Jump to home folder |
| cd - | Toggle back to previous directory |
| ls | Basic horizontal listing |
| ls -1 | One entry per line |
| ls -l | Long format: size, owner, perms, timestamp |
| ls -la | Long format + hidden files |
| ls -lh | Human-readable sizes (K/M/G) |
| ls -lt | Sort by modified time, newest first |
| ls -lS | Sort by size, largest first |
| ls -R | Recursive, walks every sub-folder |
| man cmd | Full manual page |
| man -k word | Search manual descriptions by keyword |
| mkdir name | Create one folder |
| mkdir d1 d2 d3 | Create multiple folders at once |
| mkdir -p a/b/c | Auto-create missing parent folders |
| mkdir -v name | Verbose confirmation message |
| rmdir name | Remove folder only if empty |
| rmdir -p a/b/c | Remove folder + empty parents |
| cat file | Dump file contents to screen |
| cat -n file | Show with line numbers |
| cat -b file | Number only non-empty lines |
| cat f1 f2 > out | Merge f1+f2 into new file out |
| cat > new.txt | Type text, save with Ctrl+D |
| touch file | Create empty file / update timestamp |
| touch -c file | Update timestamp only if file exists |
| cp src dst | Copy a file |
| cp -r dir1 dir2 | Copy directory recursively |
| cp -i | Warn before overwrite |
| cp -v | Verbose, show what's copied |
| mv old new | Rename file/folder |
| mv file folder/ | Move file into folder |
| mv -i | Prompt before overwrite |
| mv -n | Never overwrite existing files |
| rm file | Delete a file permanently |
| rm -r folder | Delete folder + contents |
| rm -i | Confirm each deletion |
| rm -f | Force, ignore missing files/prompts |
| rm -rf folder | Instant forceful wipe — dangerous! |
Go drill these for real in the Terminal Practice tab — typing builds muscle memory faster than reading.
touch hello.sh. First line must be the shebang: #!/bin/bash.echo "Hello!"name=mark (no spaces around =), read with $name. Names must start with a letter/underscore — 10val=10 is invalid.Full drills with typing practice are in the Shell Scripting tab.
Full calculator + pseudocode + C++ code are in the FCFS Lab tab — practice writing the code by hand for the performance test.
This is a real (simulated) Linux shell — type actual commands and see actual results. Work through the challenge list on the right in order; it checks what you typed and tells you if you got it right. Everything you type also actually changes the file tree, so mistakes behave like a real terminal.
Try: help for the full supported command list.
name=mark echo $name # mark echo "The name is $name" val10=10 # OK, starts with a letter echo $val10 10val=10 # ERROR: cannot start with a digit
read name1 name2 name3
echo "Names: $name1, $name2, $name3"
read -p "Username: " user_var # prompt + input, one line
read -sp "Password: " pass_var # -s hides typed characters
echo "Enter names: "
read -a names # -a reads into an array
echo "${names[0]}, ${names[1]}"
echo "Enter something: "
read # no varname -> goes into $REPLY
echo "Your input was: $REPLY"
#!/bin/bash
word="b"
if [ $word == "a" ]
then
echo "Condition A is true"
elif [ $word == "b" ]
then
echo "Condition B is true"
else
echo "No condition matched"
fi
# while loop
n=1
while [ $n -le 10 ]
do
echo "$n"
n=$(( n + 1 ))
done
# C-style for loop
for (( i=0; i<5; i++ ))
do
echo "$i"
done
# break: stop once i > 5
for (( i=1; i<=10; i++ ))
do
if [ $i -gt 5 ]; then break; fi
echo "$i"
done
# continue: skip 3 and 6
for (( i=1; i<=10; i++ ))
do
if [ $i -eq 3 -o $i -eq 6 ]; then continue; fi
echo "$i"
done
# Rule 1: parentheses
my_function() {
echo "Hello"
}
# Rule 2: function keyword
function my_function {
echo "Hello"
}
# Passing arguments: $1, $2, $3 ...
print_args() {
echo $1 $2
}
print_args "Hello" "World" # -> Hello World
Each drill shows a task; type the exact line of shell code in the box and press Check. This builds the same recall you'll need on paper tomorrow.
0 / 10 mastered
Enter Arrival Time (AT) and Burst Time (BT) for each process (order doesn't matter — it'll sort by AT like the real algorithm), then compute. This mirrors exactly what you'll do on paper in the performance test.
ALGORITHM FCFS_Scheduling
BEGIN
Input n (number of processes)
Input Process details (id, AT, BT)
Sort Process array P in ascending order of P[i].AT
current_time = 0
total_TAT = 0
total_WT = 0
FOR i = 0 TO n-1 DO
IF current_time < P[i].AT THEN
current_time = P[i].AT // CPU was idle
END IF
P[i].CT = current_time + P[i].BT
current_time = P[i].CT
P[i].TAT = P[i].CT - P[i].AT
P[i].WT = P[i].TAT - P[i].BT
total_TAT = total_TAT + P[i].TAT
total_WT = total_WT + P[i].WT
END FOR
Print Process details (id, AT, BT, CT, TAT, WT)
Print "Average TAT" = total_TAT / n
Print "Average WT" = total_WT / n
END
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
struct Process { int id, at, bt, ct, tat, wt; };
bool compareArrival(Process p1, Process p2) { return p1.at < p2.at; }
bool compareID(Process p1, Process p2) { return p1.id < p2.id; }
int main() {
int n;
cout << "Enter number of processes: ";
cin >> n;
Process p[n];
float total_tat = 0, total_wt = 0;
for (int i = 0; i < n; i++) {
p[i].id = i + 1;
cout << "Enter AT and BT for P" << p[i].id << ": ";
cin >> p[i].at >> p[i].bt;
}
sort(p, p + n, compareArrival);
int current_time = 0;
for (int i = 0; i < n; i++) {
if (current_time < p[i].at) current_time = p[i].at;
p[i].ct = current_time + p[i].bt;
current_time = p[i].ct;
p[i].tat = p[i].ct - p[i].at;
p[i].wt = p[i].tat - p[i].bt;
total_tat += p[i].tat;
total_wt += p[i].wt;
}
sort(p, p + n, compareID);
cout << "\nProcess\tAT\tBT\tCT\tTAT\tWT\n";
for (int i = 0; i < n; i++) {
cout << "P" << p[i].id << "\t" << p[i].at << "\t" << p[i].bt << "\t"
<< p[i].ct << "\t" << p[i].tat << "\t" << p[i].wt << "\n";
}
cout << fixed << setprecision(2);
cout << "\nAverage TAT: " << total_tat / n << "\n";
cout << "Average WT: " << total_wt / n << "\n";
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
string s[100];
int at[100], bt[100];
cin >> n;
for (int i = 0; i < n; i++) cin >> s[i] >> at[i] >> bt[i];
// bubble sort by arrival time
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (at[j] > at[j + 1]) {
swap(at[j], at[j + 1]);
swap(bt[j], bt[j + 1]);
swap(s[j], s[j + 1]);
}
}
}
int ct = 0, tat = 0, wt = 0;
cout << "process\tAt\tBt\tCt\tTAT\tWT\n";
for (int i = 0; i < n; i++) {
ct += bt[i];
tat = ct - at[i];
wt = tat - bt[i];
cout << s[i] << "\t\t" << at[i] << "\t" << bt[i] << "\t" << ct << "\t" << tat << "\t" << wt << endl;
}
return 0;
}
Note: Version B assumes zero idle CPU time (it just accumulates ct += bt[i]) — it works only when processes queue back-to-back with no gaps. Version A correctly handles idle-CPU gaps. Know both, but understand why A is more general — that's a likely viva question.
Practice by topic, or sit a timed 30-question mock that mirrors tomorrow's Quiz section exactly.
Pick a mode above to drill again — order and options reshuffle every time.
The viva draws questions from all 4 PDFs. Read the question, say your answer out loud, then reveal to check. Do a "Random 10" pass first, then "Show all" once you're confident.