OS LAB ASSIGNMENT COMPLETE SOLUTION
GLA University, Mathura
Course: B. Tech (CSE/ IBM related courses) UNIX OS Lab/BCSC 0804
Session: 2020-21
- COMMAND IMPLEMENTATION ON SHELL
1. Implement the following basic commands used in LINUX/ UNIX OS ( Also perform all the commands with their switches as assignment)
ls - List All Files Present In Current Directory
man - Online Manual(Help) About Command
pwd - Prints Current Working Directory
who - Lists who is logged on system.
whoami - Lists the Username of the current user logged in
date - Print out Current Date
cal - Print Calender
mkdir - Make a directory
rm - Remove or delete file
rmdir - Remove Directory
cat - Opens an existing file
head - Display first 10 lines of the file
tail - Dispaly last 10 files of the file
more - Look at file
less - Allow Backward movement in the file.
cp - Copy file into directory
mv- Move File
echo - Display the Value
2. a. Implement the following basic commands used in LINUX/ UNIX OS ( Also perform all the commands with their switches)
cut - Display Only the columns from file
uniq - Filter out the repeated lines in file.
chmod - Change file permissions
du - list the disk usage of the given file.
diff - Check two files are same or not.
history - Lists command You've done recently
last - Find out who has recently log in or out
sort - sorts the content in a file
sed - use to replace text in a file.
grep - find which lines in a file.
pipe - redirect standard output,input or error of one process to another.
b. Implement the special shell scripting variables such as $$,$0,$1,$*,$@,$# etc
SHELL PROGRAMMING
3. Shell scripts that uses simple commands:
a. Write a shell script to display current date in a particular format, number of users currently login and current month’s calendar
b. Write a shell script to display the process name and its process id.
c. Write a shell script to take name as a input and display a greeting message to the user by checking system clock. (Ex :- Hello John Good Morning in morning time else Hello John Good Afternoon in afternoon time else Hello John Good Evening in Evening time)
b. Write a shell script to input the name of a file as command line argument and display
whether it is a file, a directory or anything else.
c. Write a shell script to input the marks of a student in 3 subjects and find his grade
d. Write a Shell script to accept a filename as argument and displays the last
modification time if the file exists and a suitable message if it doesn't.
e. Write the shell script to take file name as input and if the file exists then print the
number of lines and also print 10th line of that file.
5. Shell scripts related to loops and arrays
a. Write a shell script that print multiplication table of a given no
c. Write a shell script that print reverse of a given positive number.
e. Write a shell to demonstrate the working of array. Input 10 integer in array and
display maximum, minimum, total sum and average of an array.
f. You are given a file with four space separated columns containing the scores of
students in three subjects. The first column contains a single character (A-Z), the
student identifier. The next three columns have three numbers each. The numbers
are between 0 and 100, both inclusive. These numbers denote the scores of the
students in English, Mathematics, and Science, respectively. Your task is to identify
whether each of the students has passed or failed.
A student is considered to have passed if (s) he has a score 50 or more in each of
the three subjects.
a. Write a shell script to input two strings from the user and determine whether they are
same or not.
c. Write a shell script to input two strings from the user and find the occurrences of
string2 in string 1.
d. Write a shell script to input the name of a file as command line argument and display
the number of characters, words and lines in the file.
e. Write a shell script to display a list of directories within the current directory and how
much space they consume, sorted from the largest to the smallest.
f. Write a short script count txt to count the total number of .txt files in the current
directory, and print out this number to screen.
Hello Guys I hope You might like these Posts.If Yes then Pls Share this link with
Your classmates and Friends !
🙏THANKS FOR VISIT🙏
OS Lab Assignment Complete Solution
Reviewed by CodexRitik
on
November 07, 2020
Rating:
No comments: