os_Assignment 1
os_Assignment 1
b) File Management:
a. Inside the "LinuxAssignment" directory, create a new file named "file1.txt". Display its
contents.
c) Directory Management:
a. Create a new directory named "docs" inside the "LinuxAssignment" directory.
d) Copy and Move Files:
a. Copy the "file1.txt" file into the "docs" directory and rename it to "file2.txt".
e) Permissions and Ownership:
a. Change the permissions of "file2.txt" to allow read, write, and execute permissions for
the owner and only read permissions for others. Then, change the owner of "file2.txt" to
the current user.
f) Final Checklist:
a. Finally, list the contents of the "LinuxAssignment" directory and the root directory to
ensure that all operations were performed correctly.
g) File Searching:
a. Search for all files with the extension ".txt" in the current directory and its subdirectories.
b. Display lines containing a specific word in a file (provide a file name and the specific
word to search).
h) System Information:
a. Display the current system date and time.
i) Networking:
a. Display the IP address of the system.
b. Ping a remote server to check connectivity (provide a remote server address to ping).
j) File Compression:
a. Compress the "docs" directory into a zip file.
b. Extract the contents of the zip file into a new directory.
k) File Editing:
a. Open the "file1.txt" file in a text editor and add some text to it.
b. Replace a specific word in the "file1.txt" file with another word (provide the original
word and the word to replace it with).
Problem 2: Read the instructions carefully and answer accordingly. If there is
any need to insert some data then do that as well.
a. Suppose you have a file named "data.txt" containing important information. Display the
first 10 lines of this file to quickly glance at its contents using a command.
b. Now, to check the end of the file for any recent additions, display the last 5 lines of
"data.txt" using another command.
c. In a file named "numbers.txt," there are a series of numbers. Display the first 15 lines of
this file to analyze the initial data set.
d. To focus on the last few numbers of the dataset, display the last 3 lines of "numbers.txt".
e. Imagine you have a file named "input.txt" with text content. Use a command to translate
all lowercase letters to uppercase in "input.txt" and save the modified text in a new file
named "output.txt."
f. In a file named "duplicate.txt," there are several lines of text, some of which are
duplicates. Use a command to display only the unique lines from "duplicate.txt."
g. In a file named "fruit.txt," there is a list of fruits, but some fruits are repeated. Use a
command to display each unique fruit along with the count of its occurrences in
"fruit.txt."
Submission Guidelines:
Document each step of your solution and any challenges faced.
Upload it on your GitHub repository
Additional Tips:
Experiment with different options and parameters of each command to explore their
functionalities.