Systems Programming Laboratory, Spring 2024-2025
Lab 1, Programming Assignment
Date: 06/01/2025
____________________________________________________________________________
Instruction: Assume you are in your home directory unless mentioned otherwise. For each of
the programs, create a separate x.txt file where x signifies the question No. In each file, write
separate comments for separate subparts (a,b,..). Finally, put all the files in a folder, make a zip
file, and upload in the teams link. Folder Format: Roll No_firstname_date. Without a proper
folder name, the assignment will not be counted for evaluation.
1. a. Create a directory structure: lab1/myWork/myAssignments1 20
b. Create a directory structure: lab1/myWork/myAssignments2
c. Assume you are in the home directory. Navigate to myAssignments2
d. Navigate to the myAssignments1 directory using a relative path.
e. Inside the myAssignments1 directory, create a new directory named
completedTasks.
f. Rename the completedTasks directory to finalTasks.
g. Display the contents of the lab1 directory in a detailed listing format to confirm the
changes.
2. a. Locate the grep, ls, and cat commands on your machine. 10
b. Save the output to a file named command_locations.txt.
3. a. Create three files named file1.txt, file2.txt, and file3.txt in the myWork
directory. 10
b. Copy the content of file1.txt to file1_backup.txt.
c. Move file2.txt to the myAssignments1 directory.
d. Delete file3.txt.
4. a. Create a file named sample.txt with the following content in myWork directory: 10
Hello, Linux learners!
Welcome to the System Programming Lab Day 1!
Happy learning!
b. Display the first two lines of the file.
c. Display the last line of the file.
d. Display the entire file content to the console.
5. a. Search for the word Linux in the sample.txt file. 10
b. Ignore case sensitivity while searching.
c. Save lines that do not contain the word Linux to a file named
non_matching_lines.txt.
6. a. Create a tarball lab1_archive.tar.gz containing all files/folders in the lab1
directory. 10
b. Extract the contents of the tarball into a directory named lab1_extracted.
c. Cross-check whether all the files/folders exist in the extracted folder
7. a. Compress the myWork directory as myWork.zip. 10
b. Extract the compressed directory.
c. Display the directory content
8. a. Create a compressed file named search_test.tar.gz that contains multiple text
files with the following content: 20
- file1.txt: "This is a test file for searching text."
- file2.txt: "Another test file to check the functionality."
- file3.txt: "This file does not contain the keyword."
b. Search for the word test within the compressed file.
c. Save the search results to a file named search_results.txt.