Os 1
Os 1
3. Check if they are created and find out what permissions are given to them by default.
8. Add a few more lines to the file using the “redirection symbols”.
9. Edit the file by opening it in vi. Identify the keys that you use for common editing:
10. Moving the cursor up, down, left, right, replacing a character, deleting a character,
inserting a line, deleting a line.
11. Change the permission of the file that you created and find out what happens with
respect to its usage.
12. Change the permission of any directory and find out what happens to its usage.
13. What are fields that are displayed in the long listing of the directory?
14. Which are the fields that can be changed using the commands that you have seen so
far? Change them and display.
16. Copy the file you created in sub_dir1 to sub_dir2. Check if the task is accomplished.
What happens to the file permissions?
19. Change the name of any file and see the changes that are made to its attributes in the
long listing of the directory.
20. Change to your home directory and search for a file that you have created.
21. Find out who all are currently using the server. List them in alphabetical order.
22. Can you list them according to the time in which they have logged in. (You may need
to know something extra to do this—do not bother if you cannot).
23. Find out if you can do more than one task---editing in one console / terminal, seeing
the “manual” in another and switching between them.
24. What are the processes that are currently running and how do you find them?
25. Can you identify how you can make the control characters of the keyboard work for
editing—backspace, del…
Grep Exercises.
1) Create an employee database (.txt file) which contains employee personal record. The
personal record includes name, DOB ( DD/MM/YYYY), address, phone number.
a) Print all Employee record that contain a phone number with an
Extension
b) Print all Employee record that do not begin with a capital A.
c) Print all Employee record whose name ends with Kumar.
d) Print all the Employee names
e) Print all the Mobile number and the land line number with name
f) Find the eldest and the youngest employee from the record set.
g) Find the age of all the employees.
2) Create book database (.txt file) which contains book name, author name, price,
publisher name and total page numbers.
a) Change the publisher name from Mc Graw Hill to Tata Mc Graw Hill
b) Find the list of books which are related with the keyword “database”
c) Find the price of all programming language books
d) Sort the books based on year of publication
e) delete the low price book details
Sample input :
1:3:5:7.5
1.5:2.5:3.5:7.5
1.5:2:3:4
1:2.5:3:4
b)Given a data file where each record contains four fields and each field is
separated from the others by a colon (:), write an awk command which will display the
records with fields 3 and 4 swapped.
Input:
CIS:160:374:A
CIS:170:373:A
CIS:118:374:A
CIS:111:374:A
CIS:150:375:A
CIS:123:350:A
c)Use grep to find and display all lines in a file which contain either the
string dog or the string cat.
d)This section turns a paragraph of text into something similar to leet speak.
Write a tr command that will turn all uppercase characters in a file to lowercase. Send
the output from that command to a sed script which does the following:
Input:
Awk Exercise
1) Create a file with the following fields: country name, capital, area, population and
continent.
a) use awk and print the record that containing ‘asia’ and africa’
b) display the rtotal number of input record and fields for the above file.
c) set the field separator as tab (\t). display the sum of area and population for all the records.
d) select all the record that begins with letter ‘s’ through ‘z’
e) select and display all the records where the population is in 5 digit number.