You are on page 1of 3

Linux Practicals to execute in Lab for practice

Assignment 1.1.1:
Write and execute the commands for the following:
i. Create three empty files with the name a1, b2, c3.
ii. Create three files with the name f6, g7, h8 using cat command with some
meaningful contents with atleast five lines each.
iii. Copy contents of f6 to a1, g7 to b2, h8 to c3.
iv. Create two directories with the name dd1, dd2.
v. Copy the files a1 and b2 to the directories dd1.Copy the files f6, g7 to the
director dd2.
vi. Remove the directory dd2 along with its contents.
vii. Rename the files a1 and b2, by newa1 and newb2.
viii. Display the login name of all users currently logged in the system.
Assignment 1.1.2:
Write and execute the commands for the following:
Create a file product1<seatno> with following fields and mentioned type of
values:
Product code
Product name
Price
Quantity
character
character
Numeric
Numeric
i.

Add at least 5 records in product1<seatno>. Fields are separated by ||


. Make a copy of product1<seatno> into product2<seatno>.
ii. Create a subdirectory COMP1<seatno>. Change to this directory & copy
two files product1<seatno> and product2<seatno>.
iii. Make a copy of file product1<seatno> into file product3<seatno>.
Display their inode numbers.
iv. Rename product3<seatno> with COMP2<seatno>.
Assignment 1.1.3:
(a) Write and execute the commands for the following:
i. Create a copy of file item1<seatno> into file item2<seatno>.
ii. Count number of lines, words & characters in a file item1<seatno>.
(b) Write and execute the commands to change the directory to /bin and do the
following:
i. list all filenames.
ii. list all filenames with one screen at a time.
iii. list all filenames with 2 characters, 3 characters.
iv. List all filenames starting with vowel.
v. List all filenames with the last character as a or b or c or d.
vi. List all filenames with exactly three characters in which the second character
is a vowel.
Assignment 1.1.4:
Write and execute the commands to change the directory to /etc and do the
following:
i. List the contents of the directory.
ii. List the contents of the directory along with all hidden files.

iii.
iv.
v.
vi.

List all files with their attributes and file permissions.


List all files identifying directories and executable files.
Give the file listing displayed in columns.
Give the file listing in reverse order.

Assignment 1.2.1:
Write and execute the commands for the following:
i.
Display /usr/sbin one screen at a time
ii.
Display /usr/sbin beginning with a lowercase c.
iii.
Display /usr/sbin in capital letters beginning with a lowercase c .
iv.
Display and count all the lines in the file /etc/mime.types
v.
Display the last 10 lines of /etc/mime.types
vi.
Display the first 25 lines of /etc/mime.types
vii.
To f.ind the files with their type in the following directories:
/etc
/usr/bin
viii.To find out how many files are in the /usr/bin directory.
Assignment 1.2.2:
Construct the commands and execute them to
i. Create a file named fsp<seat_no> having the listing of atleast 50 lines (e.g,
listing of /usr/sbin or /usr/bin or /etc or can create your own).
ii. Display first 2 lines of fsp<seat_no> and convert all the characters into
capital letters.
iii. Display the last 15 lines of fsp<seat_no>.
iv. Display the lines starting with a vowel.
v. Split the file fsp<seat_no> into subparts each having at most 20 lines and
display the contents of these subparts and count the number of lines in them.
vi. Split the file fsp<seat_no> into three subparts named fspaa, fspab, fspac and
display the contents of these files and count the number of lines in them.
Assignment 1.2.3:
Write and execute the commands for following:
i. Create a subdirectory new<seatno>. Change to this directory & create two
files new1<seatno> and new2<seatno> with two different contents
with atleast five lines each.
ii. Append the contents of new1<seat_no> to new2<seat_no>. Redirect
the output to the file new3<seat_no>.
iii. Create a directory tree dir1/dir2/dir3 in one command.
Assignment 1.2.4 :
Write and execute the commands to create a file with the name
Stud<roll_no> with the following fields separated by a blank space having the
below mentioned values:
Field
Values

RollNo
Numeric

First Name
Character

Last Name
Character

Date of Birth
dd-mm-yy

Marks
Numeric out

i
ii
iii
iv
in

of 600
Insert at least five appropriate records and do the following:
Sort the data on first names only.
Sort the data on the Marks only
Prepare a ranked merit list with students first and last name only and store
the file Merit<roll_no> and display its contents.

Assignment 1.2.5:
Construct the commands and execute them to
i Create a file named fsp<seat_no> having the listing of atleast 50 lines (e.g,
listing of /usr/sbin or /usr/bin or /etc or can create your own).
ii Display first 2 lines of fsp<seat_no> and convert all the characters into
capital letters.
iii Display the last 15 lines of fsp<seat_no>.
iv Display the lines starting with a vowel.
v Split the file fsp<seat_no> into subparts each having at most 20 lines and
display the contents of these subparts and count the number of lines in them.
vi Split the file fsp<seat_no> into three subparts named fspaa, fspab, fspac and
display the contents of these files and count the number of lines in them.
Assignment 1.2.6 :
Write and execute commands to create a file named name<roll_no> with fields
(first name, second name, last name, salary) separated by : .Insert at least five
appropriate records in above file. Perform following sort operations:
i Sort on first names only.
ii Display only those records whose first names start with a vowel.
iii Sort on last names only.
iv Display the names with salary above 10000 and and add two more records
and redirect the output to the file named namenew<roll_no>.

You might also like