Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

VIVEKANANDA INSTITUTE OF PROFESSIONAL STUDIES-

TC
VIVEKANANDA SCHOOL OF INFORMATION TECHNOLOGY

MCA-Batch (2023-2025)

Semester-I

Operating Systems with Linux Lab


Paper Code: MCA-163

Submitted in partial fulfillment of the requirements for the award of Master of Computer
Application (MCA)-I Semester

Submitted To: Submitted By:


Dr. Deepali Kamthania Name: Mohit Bisht
Professor Enroll. No: 06717704423
OS WITH LINUX
(Index)

S No Topic Problem Statement/Commands Signature


1. AP1 Run ps and note the PID of your shell. Log out and
log in again and run ps again. What do you
observe?
2. AP2 Enter the following commands, and note your
observations: (i) who and tty, (ii) tput clear, (iii) id,
(iv) ps and echo $$.
3. AP3 Run the following commands, and then invoke ls.
What do you conclude?
echo > README [Enter]
echo > readme [Enter]
4. AP4 Create a directory, and change to that directory.
Next, create another directory in the new
directory, and then change to that directory too.
Now, run $ cd without any arguments followed by
pwd. What do you conclude?
5. AP5 Create a file mca containing the words “Hello
MCA Class!”. Now create a directory vips, and
then run mv mca vips. What do you observe
when you run both ls and ls bar?
6. AP6 Run $ who am i and then interpret the output.
7. AP7 Find out whether the following commands are
internal or external: echo, date, pwd, and ls.
8. AP8 Display the current date in the form dd/mm/yyyy.
9. AP9 Both of the following commands try to open the
file mca, but the error messages are a little
different. What could be the reason?
$ cat mca
cat: mca: No such file or directory
$ cat < mca
bash: mca: No such file or directory
10. AP10 Run the following commands, and discuss their
output?
(a) $ uname
(b) $ passwd
(c) $ echo $SHELL
(d) $ man man
(e) $ which echo
(f) $ type echo
(g) $ whereis ls
(h) $ cd
(i) $ cd $HOME
(j) $ cd ~
11. AP11 Frame ls command to (i) mark directories and
executables separately, and (ii) also display
hidden files.
12. AP12 Find out the result of following:
$ cat mca mca mca
13. AP13 Run the following and determine which
commands will work? Explain with reasons.
(a) $ mkdir a/b/
(b) $ mkdir a a/b
(c) $ rmdir a/b/c
(d) $ rmdir a a/b
(e) $ mkdir /bin/mca
14. AP14 How does the command mv mca1 mca2 behave,
where both mca1 and mca2 are directories, when
(i) mca2 exists, (ii) mca2 doesn‟t exist?
15. AP15 Assuming that you are positioned in the directory
/home/vips, what are these commands presumed
to do, and explain whether they will work at all:
(a) $ cd ../..
(b) $ mkdir ../bin
(c) $ rmdir ..
(d) $ ls ..
16. Permission 1. Create a file new file. Assign all permissions to
Commands the owner and remove all permissions from
others using Relative assignment and Absolute
assignment.
2. Assuming that a file’s current permissions are
“rw-r-x-r—“, to specify the chmod expression
required to change them to:
i) r w x r w x r w x
ii) r - - r - - - - -
iii) - - r - -r - -
iv) - - - - - - - - -
Using both relative and absolute methods of
assigning permissions.
17. File 1. Write and execute Shell Script to
i. Find out whether the specified file is ordinary
directory or file?
ii. Find out whether the specified file grants read,
write or execute permission
iii. Find out whether the file exists or not, if not
then create a file
iv. Find out whether a file contains any data or
not if it contains then display the content of file
v. To display the top & last lines of user made file.
vi. To copy the contents of one file to another file
in a separate directory
vii. To display the size of files from current
working directory
viii. To accept a filename as command line
argument and print its contents
2. Write a shell script which receives two
filenames as argument it should check whether
the file content is same or not, if they are same
then 2nd file should be deleted.
18. Process Execute process command
related ps, top, pstree, nice, renice, kill, top, last, fg, bg
commands commands
19. Disk Usage and Df, du, head, tail, spell, fingers
/Miscellaneous
Commands
and use of
pipes
20. Shell Scripts- Write Shell script to
Variables- 1. To find the largest of two numbers
Environmental 2. To check whether a number is even or odd
, global and 3. To determine whether the given string is a
Local; palindrome or not.
Conditions- If, 4. To extract certain values from Environment
if --- else variable PATH
5. Accept a string on command line. If it
represents a file then show the contents, if it is a
directory show directory listing else display error
Message
21. Shell Write shell script
Scriptsnested 1. To generate first n Fibonacci numbers like: 1, 1,
if, Case------- 2, 3, 5, 13,…
esac 2. To input two strings and compare them,
whether they are equal. Print the string which is
greater (which comes later in the dictionary). Also
display the number of vowels and consonants in a
string along with the reverse of the string.
3. To input a file name and check whether the file
exists. If yes, then check whether it is a regular
file, directory, symbolic link, pipe, socket,
character device or any other type of file.
22. Shell Scripts- Write shell script
Loops-while, 1. To check whether a number entered is prime
do ---while, for or not and generate its multiplication table.
2. To print the following patterns as indicated
below:
#
##
###
####
#####
####
###
##
#
3. Created n child processes using for loop and
print the PID and PPID of each child processes.
23. Shell Script 1. Write a script to accept a file name from user
count and count the number of words in it.
2. Write a shell script to count the number of
words enclosed between $ and # symbols.
24. Array 1. Write a script to load an array with some
contents, display them, unset the entire array and
load the new contents.
2. Write a script to search an item in the array.
3. Write script to sort array using Bubble sort.
25. Shell Script Write a script to great user according to week of
Variables day and time of the day
a. Good morning 4 am-12 noon
b. Good afternoon 12 noon -5 pm
c. Good evening 5 pm -8 pm
d. Good night 8 pm – 4 am
26. Shell Script Write shell script to generate mark sheet of a
Operators student. Take 3 subjects, calculate and display
total marks, percentage and Class obtained by the
student. The marks obtained by student in five
different subject are input through a keyboard
the student gets a division as per following rules:-
a. Percentage above or equal to 60% - 1st division
b. Percentage between 50 % & 59% - 2nd division
c. Percentage between 40 % & 49% - 3rd division
d. Less than 40% fail
27. Filter Learning about regular expressions using grep,
Commands sed and awk.
1. Consider the below text file as an input.
$cat > linux.txt
unix is great os. unix is open source. unix is free
os.
learn operating system.
unix linux which one you choose.
unix is easy to learn. unix is a multiuser os. Learn
unix. unix is a powerful
Write Down the Sed commands for following.
a) Replace the word “unix” with “linux” in the file.
b) Replaces the second occurrence of the word
“unix” with “linux” in a line.
c) Replace all the occurrences of the string in the
line.
d) Replaces the third, fourth, fifth… “unix” word
with “linux” word in a line.
e) Prints the first character of every word in
parenthesis.
f) Replace the string on a specific line number.
g) Duplicating the replaced line with /p flag.
h) Printing only the replaced lines.
i) Replacing string on a range of lines.
j) Deleting lines from a particular file.
2. A file contains a fixed number of fields in the
form of space-delimited numbers.
Construct awk program to print the line as well as
a total of its row and column. The
program does not need to know the number of
fields in each line

You might also like