Linux Shell Coding Lab Report
Linux Shell Coding Lab Report
Objective:
The goal of this lab is to gain a foundational understanding of Linux, its command-
and shell scripting. The focus is on exploring Linux file structures, executing essential
Materials Required:
- Terminal access.
Theory:
1. What is Linux?
Linux is a Unix-like, open-source operating system widely used for its stability,
2. What is a Shell?
The shell is a command-line interpreter that allows users to interact with the OS.
Page 1
Lab Report: Introduction to Linux and Shell Coding
3. Shell Scripting:
Experiment Steps:
cd Example:
and directories
cp, mv Example:
new file
Page 2
Lab Report: Introduction to Linux and Shell Coding
Page 3
Lab Report: Introduction to Linux and Shell Coding
4. File Permissions
ls -l Example:
1. Creating a Script
- Write a script
hello_world.sh:
#!/bin/bash
- Command: ./hello_world.sh
- Write a script
basic_operations.sh:
Page 4
Lab Report: Introduction to Linux and Shell Coding
#!/bin/bash
Page 5
Lab Report: Introduction to Linux and Shell Coding
sum=$((num1 + num2))
Observations:
1. Basic Linux commands are intuitive and effective for file management.
Results:
Conclusion:
This lab provided hands-on experience with Linux commands and shell scripting,
enhancing the understanding of CLI operations and automation. The ability to write
scripts to perform calculations or manage files demonstrates the versatility of the Linux
environment.
Questions:
Page 6
Lab Report: Introduction to Linux and Shell Coding
Answer: Use the bash -x script.sh command to execute the script in debug mode.
Page 7
Lab Report: Introduction to Linux and Shell Coding
Page 8