0% found this document useful (0 votes)
43 views

OS File

The document is an index for a Linux OS lab at Vivekananda Institute of Professional Studies. It outlines 20 tasks for students to complete including: understanding basic commands like cat, cd, ls; using vi editor; changing file permissions; writing shell scripts; and using pipes and wildcards. The tasks involve both practical exercises and conceptual questions to help students learn Linux fundamentals.

Uploaded by

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

OS File

The document is an index for a Linux OS lab at Vivekananda Institute of Professional Studies. It outlines 20 tasks for students to complete including: understanding basic commands like cat, cd, ls; using vi editor; changing file permissions; writing shell scripts; and using pipes and wildcards. The tasks involve both practical exercises and conceptual questions to help students learn Linux fundamentals.

Uploaded by

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

VIVEKANANDA INSTITUTE OF PROFESSIONAL STUDIES

VIVEKANANDA SCHOOL OF INFORMATION TECHNOLOGY

BACHELOR OF COMPUTER APPLICATION

LINUX – OS LAB

BCA 371

Guru Gobind Singh Indraprastha University


Sector - 16C, Dwarka, Delhi - 110078

SUBMITTED TO: SUBMITTED


BY:
Ms. Megha Bansal Sahil Mendiratta
_ Assistant Professor 10729802021
VSIT BCA5B
INDEX
S. Detailed Statement Date Signature
No.
1. To understand help commands like: -man,info,help,whatis,apropos
2. To understand basic directory navigation commands like cat,cd, mv, cp,
rm, mkdir,rmdir ,file, pwd command.
3. To understand basic commands like: -
date,cal,echo,bc,ls,who,whoami,hostname,uname,tty,aliase
4. Q1. Display the name of the client machine with complete details
Q2. Count the number of words, sentences and characters in the
directory.
Q3. To list the directories and sub directories by specifying their
locations
Q4. To list the total time that the system has been setup
Q5. Display the directory contents of your directory. The output should
be multi column and should contain the hidden files.
Q6. Create and verify a new file using the cat command. Also display its
contents
Q7. Delete file(s) and directory(s)
5. Wildcards
6. To understand vi basics, three modes of vi Editor, how to write, save,
execute a shell script in vi editor.
7. To understand process related commands like: - ps, top, pstree, nice,
renice in Linux.
8. To understand how to examine and change File permissions.
9. Q1 Symbolically (e.g rwxr-xr-x), what are the permissions
644,755,000,711,700,777,555,111,600,731?
Q2 Given a file with permissions 755, what commands would change
the permissions to r-x-r--r--?
Q3. List the processes for the current shell(ps).
Q4. Display detailed information about processes(ps –f).
Q5. Search for a string inside a file
Q6. Search for a string inside the directory
Q7. Stop any currently running process
Q8. Run the process in the background
Q9. Kill the process
Q10. Search for a string recursively.
Questions on pipes
10. Set a file to be read-only with the chmod command. Interpret the file
permissions displayed by the ls -l command.
11. Delete one or more directories with the rmdir command. See what
happens if the directory is not empty. Experiment (carefully!) with the
rm -r command to delete a directory and its content.
12. Change your directory to the directory exercises. Create a file in that
directory, named the file as example1 using the cat command containing

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


the following text: water, water everywhere and all the boards did shrink;
water, water everywhere, no drop to drink.
13. Case Construct and Loops.
14. Write basic shell script to display the table of a number.
15. Write basic shell script to input a character from user and then check
whether it is uppercase, lowercase or digit.
16. Write basic shell script to calculate factorial of a number.
17. Write basic shell script to input the month number and generate
corresponding calendar.
18. Write basic shell script to list all directories
Write basic shell script to display greatest of three numbers.
19. Write basic shell script to check whether the number entered by user is
prime or not.
20. Write basic shell script to check whether the year entered is leap or not.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


1. To understand help commands like: -man,info,help,whatis,apropos.

$man

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


$Info

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


$help

$whatis

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


$apropos

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


2. To understand basic directory navigation commands like cat,cd, mv, cp, rm,
mkdir,rmdir ,file, pwd command.

1. $cat

2. $cd

3. $mv

4. $cp

5. $rm

6. $mkdir

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


7. $rmdir

8. $file

9. $pwd

3. To understand basic commands like: -


date,cal,echo,bc,ls,who,whoami,hostname,uname,tty,aliase

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


a. $date

b. $cal

c. $echo

d. $bc

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


e. $ls

f. $who

g. $whoami

h. $hostname

i. $uname

j. $tty

k. $aliase

4. Q1. Display the name of the client machine with complete details.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


Q2. Count the number of words, sentences and characters in the directory.

Q3. To list the directories and sub directories by specifying their locations.

Q4. To list the total time that the system has been setup.

Q5. Display the directory contents of your directory. The output should be
multi column and should contain the hidden files.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


Q6. Create and verify a new file using the cat command. Also display its
contents.

Q7. Delete file(s) and directory(s)

5. Wildcards

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


a. * (Asterisk): Represents any sequence of characters (including none).

b. ? (Question Mark): Represents a single character.

c. [] (Square Brackets): Represents any one character within the brackets.

d. [-] (Hyphen within Square Brackets): Represents a range of characters.

e. ^ (Caret within Square Brackets): Represents any character except those


listed.

f. ! (Exclamation Mark): Represents not. Used for negating a pattern.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


6. To understand vi basics, three modes of vi Editor, how to write, save, execute a
shell script in vi editor.

i. Regular/command mode
ii. Insert mode/Input-text mode
iii. Replacement mode

Writing, Saving, and Executing a Shell Script in vi:

a. Open/Create a Shell Script:

b. Switch to Insert Mode:


Press i to switch to Insert mode.

c. To save and quit at the same time:


Press Esc to return to Normal mode.
:wq in Command-line mode and press Enter.

d. Execute the Shell Script:

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


7. To understand process related commands like: - ps, top, pstree, nice, renice in
Linux.
a. $ps

b. $top

c. $pstree

d. $nice

e. $renice

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


8. To understand how to examine and change File permissions.

9. Q1 Symbolically (e.g rwxr-xr-x), what are the permissions


644,755,000,711,700,777,555,111,600,731?

644 = rw-r - -r- -


755 = rwxr-xr-x
000 = - - - - - - - - -
711 = rwx- - x - -x
700 = rwx- - - - - -
777 = rwxrwxrwx
555 = r-xr-xr-x
111 = - -x- -x- -x
600 = rw- - - - - - -
731 = rwx-wx- -x

Q2 Given a file with permissions 755, what commands would change the
permissions to r-x-r--r--?

Q3. List the processes for the current shell(ps).

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


Q4. Display detailed information about processes(ps –f).

Q5. Search for a string inside a file.

Q6. Search for a string inside the directory.

Q7. Stop any currently running process.

Q8. Run the process in the background

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


Q9. Kill the process

Q10. Search for a string recursively.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


Questions on pipes

10 Set a file to be read-only with the chmod command. Interpret the file
. permissions displayed by the ls -l command.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


11 Delete one or more directories with the rmdir command. See what happens if
. the directory is not empty. Experiment (carefully!) with the rm -r command to
delete
a directory and its content.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


12 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.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


13 Case Construct and Loops.
.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


14 Write basic shell script to display the table of a number.
.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


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

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


16 Write basic shell script to calculate factorial of a number.
.

Write basic shell script to input the month number and generate

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


17 corresponding calendar.
.

18 Write basic shell script to list all directories

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


.

18. Write basic shell script to display greatest of three numbers.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB
19 Write basic shell script to check whether the number entered by user is prime
. or not.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB


20 Write basic shell script to check whether the year entered is leap or not.
.

Name: Sahil Mendiratta Enrollment no: 10829802021 Section: 5-EB

You might also like