Os Lab Practical File Tushar
Os Lab Practical File Tushar
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:
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 ?
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]
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:
• 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
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 ,
1. date :
• The date command is used to display the current date and time.
- >date
->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
16
-> cal -3
->cal -A 3
->cal -B 2
17
3. echo :
Command :
Output:
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]
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:
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
# 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:
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:
Script:
24
Output:
Q8. Write basic shell script to input the month number and generate
corresponding calendar ?
Script:
25
Output:
Script:
26
Output:
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