Lab Assignment
Lab Assignment
Lab Assignment
LAB
LAB Assignment
Operating System
SUBMITTED BY:
Hassan Ali Khan
ROLL NO:
BSCS-RC-328
BATCH#
BSCS-36(MORNING)
5th SEMESTER
SUBMITTED TO:
Mam Maryam
Dated: 13/11/23
Operating Systems
LAB Assignment
QUESTION:01:
a) Use the df command to display the amount of used and available space on your hard
drive.
Output:
Explanation:
b) Check the man page for df, and use it to find an option to the command which will display the
free space in a more human- friendly form. Try both the single-letter and long-style options
and explain the answer.
Output:
Explanation:
This option stands for "human-readable" and displays sizes in
a format that is easier for humans to understand, using units
like kilobytes (KB), megabytes (MB), and gigabytes (GB). The
long-style option for this would be --human-readable.
c) Run the shell, bash, and see what happens. Remember that you were already running it to
start with. Try leaving the shell you have started with the exit command.
Output:
Explanation:
This will start a new bash shell. To exit the shell, you can use the exit command: This
will start a new bash shell. To exit the shell, you can use the exit command.
QUESTION:02:
a. Try making an empty file and using tail -f to monitor it. Then add lines to it from a different
terminal using a command like this: $ echo "testing" >>filename
Output:
Explanation:
Create an empty file, monitor it with tail -f, and add lines
using echo from a different terminal.
b. Once you have written some lines into your file, use tr to display it with all occurances of the
letters A–F changed to the numbers 0–5.
c.
Output:
Explanation:
Use tr to replace letters A-F with numbers 0-5 in the monitored
file.
d. Try looking at the binary for the ls command (/bin/ls) with less. You can use the -f option to
force it to display the file, even though it isn’t text.
Output:
Explanation:
View the binary of the ls command with less and then with od in
both default and hexadecimal modes.
Output:
QUESTION:03:
a. Use grep to find information about the HTTP protocol in the file /etc/services.
Output:
Explanation:
Use grep to find information about the HTTP protocol in the
/etc/services file.
b. Usually this file contains some comments, starting with the ‘#’ symbol. Use grep with the -v
option to ignore lines starting with ‘#’ and look at the rest of the file in less.
Explanation:
Use grep -v to ignore lines starting with '#' (comments) and
view the remaining content in less.
c. Add another use of grep -v to your pipeline to remove blank lines (which match the pattern
ˆ$).
Explanation:
Add another grep -v to remove blank lines from the output of the
previous command.
…..…………………END……………………