0% found this document useful (0 votes)
33 views33 pages

Os Lab Practical File Tushar

The document is a certificate for a student named Tushar Sharma confirming the completion and authenticity of their practical lab file for an Operating Systems and Linux Programming course. It describes Tushar Sharma as a dedicated student who demonstrated commitment, proficiency, and understanding in meeting the standards for the practical exercises. The certificate endorses that the submitted lab file reflects Tushar Sharma's comprehensive grasp of the subject matter and their ability to apply knowledge to practical scenarios in adherence to academic integrity standards.

Uploaded by

datob38982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views33 pages

Os Lab Practical File Tushar

The document is a certificate for a student named Tushar Sharma confirming the completion and authenticity of their practical lab file for an Operating Systems and Linux Programming course. It describes Tushar Sharma as a dedicated student who demonstrated commitment, proficiency, and understanding in meeting the standards for the practical exercises. The certificate endorses that the submitted lab file reflects Tushar Sharma's comprehensive grasp of the subject matter and their ability to apply knowledge to practical scenarios in adherence to academic integrity standards.

Uploaded by

datob38982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

JAGAN INSTITUTE OF MANAGEMENT STUDIES

SECTOR – 5, ROHINI, NEW DELHI

(Affiliated to) GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY


SECTOR – 16 C, DWARKA, NEW DELHI

Operating System & Linux Programming


PRACTICAL LAB FILE (BCA-371)

Submitted To: Submitted By:


Dr. Shivani Vats Name:Tushar Sharma

(Assistant Professor) Enrollment No. : 03750402021

BCA 3rd Year 2nd Shift

1
CERTIFICATE

This serves to confirm that the Operating System & Linux Programming Practical Lab File
submitted by Tushar Sharma, a dedicated BCA student in the 5th Semester, 2nd Shift, is an
authentic representation of his work. The completion of this lab file is part of the academic
requirements for the partial fulfillment of the BCA degree.

Under my guidance and supervision, Tushar Sharma has demonstrated a commendable level
of commitment and proficiency in meeting the standards outlined for the practical exercises
related to operating systems and Linux programming. The submitted lab file reflects his
comprehensive understanding of the subject matter and his ability to apply theoretical
knowledge to practical scenarios.

I endorse the originality of the content presented in this lab file, which has been created in
adherence to the academic integrity standards of the institution. Tushar Sharma’s
conscientious approach to the learning process is evident in the quality of work submitted,
affirming his successful completion of the assigned tasks and meeting the requisite standards
for the BCA degree.

Date:

Dr. Shivani Vats


(Asst. Professor – IT)

2
ACKNOWLEDGEMENT

I Tushar Sharma the student of BCA 3rd year, am extremely grateful to JIMS college for the
confidence bestowed in me and entrusting my Practical file of Operating System & Linux
Programming. At this juncture I feel deeply honoured in expressing my sincere thanks to my
faculty, Dr. Shivani Vats for her valuable inputs, her guidance, encouragement and
wholehearted cooperation and constructive criticism throughout the preparation of this
practical file.

I take this opportunity to thank all the lab assistants, coordinators who have directly or
indirectly without which this file would not have been possible.

Lastly but not the least I place a deep sense of gratitude to my family members and my friends
who have been constant source of inspiration during the preparation of this Practical file.

Student Name:
Tushar Sharma

3
INDEX
S no. List of Practicals Page No. Signature
To understand help commands like :- man , info , help ,
1
whatis , apropos ?
To understand basic directory navigation
2
command like cat , cd , mv , cp, rm , mkdir , rmdir
command ?

To under stand basic commands like :- date , cal , echo ,


3 bc , ls , whoami ,hostname ,uname ?

Set file to be read-only with the chmod command.


4
Interpret the file ?
Write a shell script to display the table of a number ?
5

Write basic shell script to input a character from user and


6 then check whether it is uppercase , lowercase or digit ?

Write basic shell script to calculate factorial of a number


7
?
Write basic shell script to input the month number and
8
generate corresponding calendar ?
Write basic shell script to list all directories ?
9
Write basis shell script to display greatest of three
10
number?
Write basis shell script to display greatest of three
11
number?
Write shell script to check whether the number entered by
12
user is Armstrong or not using while while ?
Write basic shell script to check whether the number
13
entered by users is palindrome or not using while ?
Write basic shell script to execute different basic
14
arithmetic calculation using switch ?
Write basic shell script to print Fibonacci series using for
15
loop ?

4
Q1. To understand help commands like :- man , info , help , whatis , apropos ?

1. man :
• Syntax : man [command]

• The man command is used to display the manual pages for a particular command
or topic. It provides detailed information about the specified command.

Command:

Output:

2. info:
• Syntax: info [command]

• The info command is similar to man but provides a more structured and
hypertextlike navigation. It's often used for GNU software and may contain
more in-depth information compared to man pages.

Command:

5
Output:

3. help :
• Syntax: help [command]

• The help command is built into the shell and provides information about shell
built-in commands. When used without specifying a command, it displays a list
of built-in commands.

Command:

6
Output:

4. whatis :
• Syntax: whatis [command]

• The whatis command is used to display a one-line description of a specified


command.

Command:

Output:

7
5. apropos :
• Syntax: apropos [keyword]

• The apropos command is used to search the manual pages for commands and
keywords. It helps you find commands related to a particular topic.

Command:

8
Output:

Q2. To understand basic directory navigation command like cat , cd , mv , cp,


rm , mkdir , rmdir command ?

1. cat : • syntax : cat file_name

• The cat command is used to concatenate and display the contents of one or more
files. It's also frequently used to create and append to files.

Command :

9
Output:

2. cd :
• Usage: cd directory

• The cd command is used to change the current working directory. It allows


you to navigate through the file system.

Command:

10
Output:

3. mv :
• syntax : mv [source] [destination]
• The mv command is used to move or rename files and directories.

Command:

Rename file

Move

Output:

Rename file:

Move file:

4. cp :
• syntax: cp [source] [destination]

11
• The cp command is used to copy files or directories from one location to
another. Command :

Output:

5. rm :
• Syntax : rm file_name
• The rm command is used to remove or delete files and directories.
Command :

12
Output:

6. mkdir :
• Usage: mkdir [directory]
• The mkdir command is used to create a new directory.
Command:

Output:

7. rmdir :
• syntax: rmdir [directory]
• The rmdir command is used to remove an empty
directory. command:

13
Output:

14
Q3. To under stand basic commands like :- date ,

cal , echo , bc , ls , whoami ,hostname ,uname ?

1. date :

• The date command is used to display the current date and time.
- >date

- >date --date = "yesterday"

-> date --date = "2 years ago"

-> date --date = "5 year"

-> date --date = "next tuesday"

->date "+%D" :- date come in formate of mm/dd/yyyy

-> date "+%d"

-> date "%b" :- show name of month

->date “%B”

15
2. cal :

• The cal command is used to display a calendar for a specified month or the current month.

-> cal

-> cal -y

-> cal 12 2024

16
-> cal -3

->cal -A 3

->cal -B 2

17
3. echo :

• The echo command is used to print text or variables to the terminal.

-> Print text

Command :

Output:

-> Redirect text to file

Command:

Output:

18
4. ls :

• The ls command is used to list files and directories in the current directory or a
specified path.

Command:

Output:

5. bc :
• The bc command is a basic calculator that can perform arithmetic
calculations. ->Addition

->Subtraction

->Multiplication

->Division

->Remainder

-> Exponentiation

6. whoami : • The whoami command is used to display the username of the current user.

19
Command:

Output:

7. hostname :
• The hostname command is used to display the name of the current host or the
system's hostname.

Command:

Output:

8. uname :
• The uname command is used to display system information such as the kernel
name, network node hostname, kernel release, and more.

Command :

Output:

20
Q4. Set file to be read-only with the chmod command. Interpret the file ?
'chmod' stands for "Change Mode". Every file or folder has a set of permissions that control the permissions
like who can read/write/execute the file. So, 'chmod' allows us to change the access permissions of a file or a
directory.
Syntax: chmod [option]

The mode can be specified in 2 modes:

a. Symbolic Mode: It is the most common method for specifying file permission. In this
mode, we make a combination of letters and operators to set or tell the references what
to do with permissions. This can be understood using the given tables:

Operators Definition Lett Reference Definition

+ Adds permissions r u Owner

- Removes permissions w g Group

Sets permissions to a o Others


= specified value x
a All (Owners, Groups, Others)

Example: chmod u+rw,go+r file.extn Explanation:


i. Add(+) Read(r) and Write(w) permissions to Owner(u)
ii. Add(+) Read(r) permission to Group(g) and Owner(o)

b. Octal Mode: In this mode, we specify permissions using 3-digit number, where:
i. First digit specifies the permission for Owner. ii.
Second digit specifies the permission for Group.
iii. Third digit specifies the permission for Others.

The digits are calculated by adding the values of the individual permissions.

Operators Definition

4 Read permission

2 Write permission

1 Execute permission

Example: chmod 674 file.extn


Explanation:
i. Owner has 6 = 4(read) + 2(write) permission
ii. Group has 7 = 4(read) + 2(write) + 1(execute) permission
iii. Others have 4 = 4(read) permission

# To view the permissions of all the files and folders in the current working directory, we type: " ls -l "

21
# To view the permissions of a particular file or folder in the current working directory, we type: " ls -l file_name
"

Command :

Output:

-> Reading file3.txt

Q5. Write a shell script to display the table of a number ?

22
Script:

Output:

Q6. Write basic shell script to input a character from user and then check whether it
is uppercase , lowercase or digit ?

Script:

23
Output:

Q7. Write basic shell script to calculate factorial of a number ?

Script:

24
Output:

Q8. Write basic shell script to input the month number and generate
corresponding calendar ?

Script:

25
Output:

Q9. Write basic shell script to list all directories ?

Script:

26
Output:

Q10. Write basis shell script to display greatest of three number ?

Script:

Output:

27
Q11. Write basic shell script to check whether the number entered by user is prime or not?

Script:

Output:

28
Q12. Write shell script to check whether the number entered by user is Armstrong or
not using while while ?

Script :

Output:

29
Q13. Write basic shell script to check whether the number entered by users is palindrome
or not using while ?

Script :

Output:

30
Q14. Write basic shell script to execute different basic arithmetic calculation using switch?

Script:

Output:

31
Q15. Write basic shell script to print Fibonacci series using for loop ?

Script:

Output:

32
33

You might also like