[go: up one dir, main page]

0% found this document useful (0 votes)
6 views3 pages

OS Lab Assignment Session 1 To 4

assignments
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)
6 views3 pages

OS Lab Assignment Session 1 To 4

assignments
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/ 3

CSE Department, NIT Patna

UNIX Assignment
SESSION-1
Write commands for the following:-

Q.1 >Login into your UNIX system.


Q.2 >Print the name of your current directory
Q.3 >Find out the list of users currently logged into UNIX system.
Q.4 >Find out your Login information
Q.5 >Change your password
Q.6 >List all the files from current directory using short form
Q.7 >List all the files from the current directory using long format. Find the difference
with the output generated in Q.6
Q.8 >List all the files whose names starts with the letter 'p' from current directory.
Q.9 >List the contents of the current directory in the formatted form.
Q.10 >Search the UNIX manual for help on the 'ls' command.

SESSION-2

Q.1 >Change the current directory to the '/bin' directory.


Q.2 >List the contents of the '/' directory int the long format.
Q.3 >Change current directory to '/usr/bin'.
Q.4 >List all the files including the hidden files from the current directory.
Q.5 >List all files in page wise order using 'more' Ans.
Q.6 >Change the current directory to your home directory.
Q.7 >Create the following directory structure inside your current directory(i.e. home
directory).
official

documents programs data

letters notes corporate branch corporate branch


(f) (d) (f) (f) (d) (d)
f – File d - Directory

Q.8 > Make 'official/data/branch' your current working directory.

Q.9 >Create a file named 'student.dat' and record course name, roll no and student name
about at least 10 students from different courses into it. Each field should be separated
by a (comma). Use 'cat' command with redirection to create this file.

Q.10 >Clear the screen and show the contents of the file created in question 9.
SESSION-3

Q.1 >Change directory to 'official/data/branch' and Add information about 10 more


students in the 'student.dat' file created in Question 9 of Session-2. The previous
information stored in that file should be preserved. Use 'cat' command with
redirection to add new information.

Q.2 >Create another file named 'exstudent.dat' and record course name, roll no, student
name and year of passing of those students who have completed their course. Each
field should be separated by ','(comma).Record information about at least 10 such
students.

Q.3 >Show the contents of both 'student.dat' and 'exstudent.dat' together on screen
using 'cat' command. The output should appear in page wise order.

Q.4 >Create a new file named 'allstudents.dat' that contains the records from both
'exstudent.dat' and 'student.dat'.

Q.5 >Now copy this 'allstudents.dat' file to the location 'official/data/corporate'

Q.6 >Change your current working directory to 'official/data/corporate'.

Q.7 >Create a file named 'cstudent.dat' and record course name, roll no, student
name, designation, and company name of about at least 10 corporate students in
different courses from different companies into it. Each field should be
separated by a ','(comma). Use 'vi' editor to create this file.

Q.8 >Write methods for performing following task in the 'vi' editor.

a) Enable 'insert' mode for inserting text in the document.


b) Cancel the current mode.
c) To replace a single character.
d) To append text at the current position.
e) To add text at the end of the current line.
f) To delete character at the cursor position.
g) To delete an entire line.
h) To undo the most recent change.
i) To move cursor left.
j) To move cursor right.
k) To move cursor up.
l) To move cursor down.
m) To move cursor at end of line.
n) To move cursor at beginning of line.
o) To temporarily exit to the shell prompt.
p) To search for a pattern in forward direction.
q) To search for a pattern in backward direction.
r) To save the current file.
s) To abort changes and exit to shell prompt.
t) To save changes and exit to shell prompt.
SESSION-4

Q.1 >Change directory to 'official/data/corporate'.

Q.2 >Merge the contents of 'cstudent.dat' with 'allstudents.dat'.

Q.3 >Move 'allstudents.dat' to the location 'official/data'.

Q.4 >Change the current directory to 'official/programs/branch'

Q.5 >Create a link named 'studentL.dat' in the directory. The link should refer
to 'student.dat' file located at official/data/branch location.

Q.6 >Create another link named 'cstudentL.dat' in the directory


'official/programs/corporate'. This link should refer to 'cstudent.dat' file
located in the 'official/programs/corporate' directory.

Q.7 >Now show the contents of 'studentL.dat

Q.8 >Rename 'studentL.dat ' to 'student.lnk'

Q.9 >Rename 'documents' directory to 'doc'

Q.10 >Create copy of 'allstudents.dat' file from location 'official/data' into


location 'official/programs', change the name of this copied file to
'ourstudents.dat'

You might also like