OS Practical File
OS Practical File
LINUX – OS
PRACTICAL FILE
SUBJECT CODE – BCA 371
Ques. Write the steps to connect the Linux Server and understand the basic
Directory Structure of Linux.
Theory :-
➢ Steps to connect with Linux Server:
• Open a terminal (for Linux) or a command line (for Windows) on your
computer.
• Enter the command: ssh [username]@[server IP]
Page 3 of 26
• /media (Media) : Mount points for removable media like USB drives are
created here.
• /proc (Process) : Virtual directory containing information about processes
and system resources.
• /srv (Service) : Data for services provided by the system is stored here.
• /boot (Boot Loader) : Boot loader files and the kernel and stored here.
• /lib64 (64-bit Libraries) : 64-bit libraries are stored here on 64-bit systems.
• /run (Runtime) : Temporary files created by system processes are stored
here.
• /sys (Sysfs) : A virtual file system exposing kernel information.
• /lost+found (Lost and Found) : Recovered files after a system crash are
placed here.
Page 4 of 25
Practical – 2
Ques. To understand help commands like : man, info, help, whatis, apropos.
Theory :-
1. man (Manual) : The man command is used to display the manual or documentation
for a particular command. It provides detailed information about the command,
including its usage, options, and examples.
Page 5 of 25
2. info: The info command is similar to man but often provides more detailed and
structured information. Its commonly used for GNU software.
3. help: The help command is built into shell (e.g., Bash) and provides information
about shell built-in commands. Its not used for external commands.
Page 6 of 25
4. whatis: The whatis command provides a brief description of a command. Its useful
for quickly finding out what a command does without displaying the full manual
page.
5. apropos: The apropos command is used to search the manual page names and
description for a specified keyword. It helps ypu find relevant commands based on a
particular topic.
Page 7 of 25
Practical – 3
Ques. To understand basic directory navigation commands like: cat, cd, mv,
cp, rm, mkdir, rmdir, file, pwd, command.
Theory :-
1. cat (Concatenate and Display): The cat command is used to concatenate and
display the content of files.
4. cp (Copy): The cp command is used to copy files or directories from one location
to another.
Page 8 of 25
5. rm (Remove/Delete): The rm command is used to remove or delete files or
directories.
6. mkdir (Make Directory): The mkdir command is used to create a new directory.
9. pwd (Print Working Directory): The pwd command prints the current working
directory.
Page 9 of 25
Practical – 4
Ques. To understand basic commands like: date, cal, echo, bc, ls, who,
whoami, hostname, uname, tty, aliase.
Theory :-
1. date: The date command is used to display or set he system date and time.
3. echo: The echo command is used to print text or variables to the terminal.
Page 10 of 25
5. ls (List): The ls command is used to list the contents of a directory.
6. who: The who command displays information about users who are currently
logged in.
7. whoami: The whoami command prints the username of the current user.
9. uname (Unix Name): The uname command provides system information like the
kernel name, network node hostname, kernel release, kernel version, and
machine hardware.
Page 11 of 25
10. tty (TeleTypewriter): The tty command prints the file name of the terminal
connected to the standard input.
11. alias: The alias command is used to create a shortcut or alias for a longer
command.
Page 12 of 25
Practical – 5
Ques. To understand process related commands like: ps, top, pstree, nice,
renice in linux.
Theory :-
1. ps (Process Status): The ps command is used to display information about active
processes.
2. top: The top command provides a dynamic, real-time view of the system
processes. It displays information about CPU usage, memory usage, and other
system statistics.
Page 13 of 25
3. nice: The nice command is used to run program with a specified priority, it
influences the scheduling priority of a process.
4. renice: The renice command is used to alter the priority of a running process.
Page 14 of 25
Practical – 6
Theory :-
• Open a new or existing shell script file:
• Save and exit: Press esc to ensure you are in normal mode. Type :wq and press Enter.
Page 15 of 25
Practical – 7
Theory :-
• ls Command: The ls command with -l option shows a detailed listing, including file
permissions.
• stat Command: The stat command provides detailed information about a file,
including access and modification times.
Page 16 of 25
Practical – 8
Ques. Set a file to be read-only with the chmod command. Interpret the file
permissions displayed by the ls -l command.
Theory :-
• Set a file as Read-only:
Page 17 of 25
Practical – 9
Ques. Change your directory to the directory exercises. Create a file in that
directory, named the file as example1 using the cat command containing the
following text: water, water everywhere and all the boards did shrink; water,
water everywhere, no drop to drink.
Theory :-
• Create a new Directory named exercises.
• Create new file in exercises named as example1 and enter the text.
Page 18 of 25
Practical – 10
Theory :-
• Create a new file, for example, table.sh, and add the content.
Page 19 of 25
Practical – 11
Ques. Write basic shell script to input a character from user and then check
whether it is uppercase, lowercase or digit.
Theory :-
• Create a new fil, for example, check_char.sh, and add the content:
Page 20 of 25
Practical – 12
Theory :-
• Create a new file, for example, fact.sh, and add the content:
Page 21 of 25
Practical – 13
Ques. Write basic shell script to input the month number and generate
corresponding calendar.
Theory :-
• Create a new fil, for example, cal.sh, and add the content:
Page 22 of 25
Practical – 14
Theory :-
• Create a new file, for example, di.sh. and add the content:
Page 23 of 25
Practical – 15
Theory :-
• Create a new file, for example, max.sh. and add the content:
Page 24 of 25
Practical – 16
Ques. Write basic shell script to check whether the number entered by user is
prime or not.
Theory :-
• Create a new file, for example, check_prime.sh. and add the content:
Page 25 of 25