You are on page 1of 3

Linux Command Exercises

Ex1. i) Create the following directory structure and do the following in your home directory. mvgr

cse

ece

IT

SecA

SecB

SecA

SecB

SecC

ii) Create a file named students.txt in mvgr directory iii) copy students.txt to ece and it directories iv) create a file named marks.txt in mvgr/cse/SecA v) copy marks.txt from cse/SecA to cseSecB ece/SecA ece/SecB ece/SecC and IT directories vi) print the tree structure of mvgr including files and subdirectories vii) create eampty files of a.txt b.txt c.txt abcd.dat in cse/SecA directory viii) copy all .txt files to ece/SecA directory ix) move abcd.dat file from cse/SecA to IT directory x) display the directory structure of mvgr xi) copy the mvgr directory to mvgr1 in your home directory xii) remove mvgr directory structure

Ex2: i) Create file with the following data using vi editor and name it as empnames.dat Kiran A 15000 Rahul D 12000 Devaraj K 14000 Mohan S 22000 Rahul K 17000 Haritha S 20000 Mohan S 22000 Devika D 16000 Rahul D 12000 Kiran A 15000 ii) iii) iv) v) Remove all duplicate lines. Remove all duplicate lines and store it in a separate file named empsort.txt Find out no. of words lines and characters in empsort.txt Find out no. of lines and characters in empsort.txt

Ex3: Create a file with the following data and name it as eamcet.dat and do the following operations 101 rahul 45 40 35 120 102 david 48 42 35 125 103 lakshmi 40 40 35 115 104 hari 50 45 40 135 105 geetha 50 47 38 135 106 jeevan 45 45 40 130 107 fazil 45 45 30 120 108 savitha 50 35 45 130 109 rani 40 45 50 135 110 kumar 35 40 40 115 i) ii) Give ranks based on the total, maths, physics, chemistry and names and store it a separate file named with eamcetranks.txt in descending order Convert all lowercase letters in eamcetranks.txt file to uppercase

Ex4: Do the following from eamcetranks.txt

i) ii) iii) Iv iv)

Display 1st 5 lines Display last 5 lines Display 4 to 8 lines Create hard link for eamcet.dat with name eam.dat and write your observations Create a soft link for eamcetranks.txt with name eamsoft.txt and write your observations

v) vi)

Copy eamcetranks.txt to eamcetranks2.txt Remove eamcet.dat and eamcetranks.txt files and write your observations.

You might also like