1
1
Session-1
  1. Log into the system
  2. Use ‘VI” editor to create a file called myfile.txt which contains some text.
  3. Correct typing errors  during creation
  4. Save the file
  5. Logout of the system
2
Session-2
  1. Log into the system
  2. Open the file created in session-1.
  3. Add some text
  4. Change some text
  5. Delete some text.
  6. Save the file
  7. Logout of the system
2

  1. Log into the system
  2. Use the ‘cat’ command to create a file containing the following data. Call it mytable use tabs to separate the fields.
1425    ravi      15.65
4320    ramu    26.27
6830    sita       36.15
1450    raju      21.86
  1. Use the cat command to display the file, mytable.
  2. Use the ‘vi’ command to correct any errors in the file, mytable.
  3. Use the ‘sort’ command to sort the file my table according to the first field. Call the sorted file my table (same name)
  4. Print the file mytable.
  5. Use the cut and paste commands to swap fields 2 and 3 of mytable. Call it my table (Same name)
  6. Print the new, my table.
  7. Logout of the system
3
1
a)      Login to the system
b)      Use the appropriate command to determine your login shell
c)      Use the /etc/passwd file to verify the result of step b.
d)     Use the ‘who’ command and redirect the result to a file called myfile1. Use the more command to see the contents of myfile1.
e)      Use the date and who commands in sequence (in one line) such that the output of date will display on the screen and the output of who will be redirected to a file called myfile2. Use the more command to check the contents of myfile2.
2
a)      Write a “sed” command that deletes the first character in each line in a file.
b)      Write a “sed” command that deletes the character before the last character in each line in a file.
c)      Write a “sed” command that swaps the first and second words in each line in a file.



4

a)      Pipe your /etc/passwd file to awk, and print out the home directory of each user.
b)      Develop an interactive “grep” script that asks for a word and a file name and then tells how many lines contain that word.
c)      Repeat
d)     Part using “awk”
5

a)      Write a shell script that takes a command –line argument and reports on whether it is directory, a file, or something else.
b)      Write a shell script that accepts one or more file name as arguments and converts all of them to uppercase, provided they exist in the current directory.
c)      Write a shell script that determines the period for which a specified user is working on the system.
6

a)      Write a shell script that accepts a file name starting and ending line numbers as arguments and displays all the lines between the given line numbers.
b)      Write a shell script that deletes all lines containing a specified word in one or more files supplied as arguments to it.
7

a)      Write a shell script that computes the gross salary of a employee according to the following rules:
                               I.            If basic salary is < 1500 then HRA =10% of the basic and DA =90% of the basic.
                            II.            If basic salary is >=1500 then HRA =Rs500 and DA=98% of the basic
The basic salary is entered interactively through the key board.
b)        Write a shell script that accepts two integers as its arguments and computers the value of first number raised to the power of the second number.
8

a)      Write an interactive file-handling shell program. Let it offer the user the choice of copying, removing, renaming, or linking files. Once the user has made a choice, have the program ask the user for the necessary information, such as the file name, new name and so on.
b)      Write  shell script that takes a login name as command – line argument and reports when that person logs in
c)      Write a shell script which receives two file names as arguments. It should check whether the two file contents are same or not. If they are same then second file should be deleted.
9

a)      Write a shell script that displays a list of all the files in the current directory to which the user has read, write and execute permissions.
b)      Develop an interactive script that asks for a word and a file name and then tells how many times that word occurred in the file.
c)      Write a shell script to perform the following string operations:
                                i.            To extract a sub-string from a given string.
                              ii.            To find the length of a given string.



10

Write a C program that takes one or more file or directory names as command line input and reports the following information on the file:
      i.     File type
    ii.     Number of links
  iii.     Read, write and execute permissions
  iv.     Time of last access
(Note : Use stat/fstat system calls)
11

Write C programs that simulate the following UNIX commands:
  1. mv
  2. cp
(Use system calls)
12

Write a C program that simulates ls Command

13

  1. Write a shell script to check whether a particular user has logged in or not. If he has logged in, also check whether he has eligibility to receive a message or not.
  2. Write a shell script to accept the name of the file from standard input and perform the following tests on it
a)      File executable
b)      File readable
c)      File writable
d)     Both readable & writable
  1. Write a shell script which will display the username and terminal name who login recently in to the unix system
  2. Write a shell script to find no. of files in a directory
  3. Write a shell script to check whether a given number is perfect or not
  4. Write a menu driven shell script to copy, edit, rename and delete a file
  5. Write a shell script for concatenation of two strings
  6. Write a shell script which will display Fibonacci series up to a given number of  argument.
  7. Write a shell script to accept student number, name, marks in 5 subjects. Find total, average and grade. Display the result of student and store in a file called stu.dat.
Rules:
avg>=80 then grade A
Avg<80&&Avg>=70 then grade B
Avg<70&&Avg>=60 then grade C
Avg<60&&Avg>=50 then grade D
Avg<50&&Avg>=40 then grade E
Else grade F
  1. Write a shell script to accept empno,empname,basic. Find DA,HRA,TA,PF using following rules. Display empno, empname, basic, DA,HRA,PF,TA,GROSS SAL and NETSAL. Also store all details in a file called emp.dat
Rules:
HRA is 18% of basic if basic > 5000 otherwise 550
DA is 35% of basic
PF is 13% of basic
IT is 14% of basic
TA is 10% of basic
  1. Write a shell script to demonstrate break and continue statements
  2. Write a shell script to satisfy the following menu options
a)      Display current directory path
b)      Display todays date
c)      Display users who are connected to the unix system
d)     Quit
  1. Write a shell script to delete all files whose size is zero bytes from current directory
  2. Write a shell script to display string palindrome from given arguments
  3. Write a shell script which will display Armstrong numbers from given given arguments.
  4. Write a shell script to display reverse numbers from given argument list
  5. Write a shell script to display factorial value from given argument list
  6. Write a shell script which will find maximum file size in the given argument list
  7. Write a shell script which will greet you “Good Morning”, ”Good Afternoon”, “Good Evening’ and “Good Night” according to current time.
  8. Write a shell script to sort the elements in a array using bubble sort technique
  9. Write a shell script to find largest element in a array
  10. Write an awk program to print sum, avg of students marks list
  11. Write an awk program to display students pass/fail report
  12. Write an awk program to count the no. of vowels in a given file
  13. Write an awk program which will find maximum word and its length in the given input File
  14. Write a shell script to generate the mathematical tables.
  15. Write a shell script to sort elements of given array by using selection sort.
  16. Write a shell script to search given number using binary search.
  17. Write a shell script to find number of vowels, consonants, numbers, white spaces and special characters in a given string.
  18. Write a shell script to lock the terminal.







0 comments: