EXPERIMENT 1

Familiarisation with Basic Linux Commands

AIM: Get familiar with basic Linux debugging and analysis commands: ps, strace, gdb, strings, objdump, nm, file, od, xxd, time, fuser, top.

Theoretical Background

No C program is written for this experiment. Instead, create a simple C program, compile it, and practice each command on it. These commands allow developers to analyze binary files, monitor system calls, track resources, and debug compiled applications.

Sample Execution Readout

bash
$ ps aux // List all running processes USER PID %CPU %MEM VSZ RSS STAT COMMAND root 1 0.0 0.1 16952 1032 Ss /sbin/init $ strace ./hello // Trace system calls made by hello execve("./hello", ["./hello"], 0x...) = 0 write(1, "Hello, OS Lab!\n", 15) = 15 exit_group(0) $ file hello // Show file type and architecture hello: ELF 64-bit LSB executable, x86-64 $ time ./hello // Measure execution time Hello, OS Lab! real 0m0.002s user 0m0.001s sys 0m0.001s