Ravi Tutorials Provide Project Training

TYBCA Unix Assignments

TYBCA Unix Assignments


Tutorial-1
Subject : Unix & shell programming
Duration : 35 Min

1. Display the content of current directory
2. Show calender of january 1980
3. show the current working directory.
4. Display date and time in format shown in brackets ( Sun June 19,11:40PM )
5. Display the below pattern with echo command
\
\ \ \
\ \ \ \ \
6. Execute a command to know the kernel version of operating system you are 
   working on
7. Execute a command to know your terminal
8. Execute a command to identify all executables in current working directory.
9. Display a sorted list of files by last access time.
10. create five files named f1 to f5.
11. copy the content of f1 and f2 into f3.
12. display all files from current directory having first and last character as 
    number.
13. display the list of all file names that contains only 3 latters.
14. create a file named "-abc" in current working directory.
15. count the number of characters of file "-abc".
16. rename file "ex1" to "as1".
17. copy those files that must contains 3rd character in the file name as digit
    to the directory "xtemp".
18. create directory named "helix", "apache".
19. copy the "helix" directory to "tmp" directory.
20. move those files having last character as digit to the "apache".
21. remove file "-abc".


 
Tutorial-2
Subject : Unix shell programming
Duration: 60 Min

1. list the content of currrent directory having file names as number.
2. display the filename containing only alphabats as a names.
3. remove all files containing digit as the 2nd latter as their names.
4. create the file named " asd[0-9]".
5. copy the content of file c- to c1,c2,c3.
6. display the date in the following format
e.g. "Today's date is : Sat Jul 30 15:25:31 IST 2011"
7. compare 2 files named sc1, sc2 and store the common content in file result.
8. find how many number of lines from sc1 and sc2 are common.
9. display only those files containing the more then 5 character as there names
     ( the file names having
last two characters as digit).
10. create the directory named "maxx" and copy all files having only capital 
    letters.
11. create a file named emp*
12. make a list of employee in following order ( use vi editor ).
empid empname post
1 abcd programmer
2 xyz manager

13. display only the last accessed file from current directory.
14. create file named emp_list having empid and date of joining.
15. copy the content of file "emp*" in emp_master1,emp_master2
16. rename file emp_master2 to backup_emp
17. remove file "emp*"
18. display the path of the directory where all your mail are stored.
19. create the following structure

export
|-- color
|-- dir1
|-- file1.lst
|-- m1
| |-- f1
| | `-- emp.lst
| `-- f2
|
`-- menu1.lst
|-- m2
| |-- d1
| `-- file123
`-- m3
|-- abc.php
|-- dir1
| `-- tmp
`-- xyz.java

20. copy file emp.lst to tmp directory ( in m3 dir ) using relative path.
21. protect the directory "export" against unauthorized access.
22. allow only read access to file emp.lst.
23. assign write permission only for group members and the rest permissions 
    remain intact for the directory "d1"
24. copy the content of file emp.lst to file123, make back up of file 'file123'
     and rename it with file_bkp
25. display the content of "export" directory in a way like question-19
26. display last modified file.
27. make archive file of all the files having .lst extension
28. move all .lst files to tmp directory
29. provide the permissions to the file "color" in such a way that only the 
     owner can perform read and write operation while group members and others 
     can only execute a file.
30. change the ownership of file "tmp" to root


 
Tutorial-3
Subject : Unix shell programming
Duration: 60 Min

1. write a command to display content of top 3 largest file in a working directory.
2. Count no. of words in lines 40 through 60 of file f1.txt.
3. Display all filenames not beginning with “.”.
4. delete all special characters from file x1.
5. Display i-node no of all files of current directory.
6. Display those lines of file f1 that contains exactly 50 characters in it.
7. Replace 'hello' with “HELLO” in input file fin.sh and write those lines to 
    output file fout.sh
8. extract all username and their home directory form /etc/passwd file.
9. Locate lines of file where the second and second last character of the lines 
   are same.
10. Display all lines of files that contains “hello” pattern in it.
11. Display all lines having “g*” pattern in it.
12. Change modification time of file to Dec 25, 10:30 AM.
13. List all files of working directory having at least 4 characters in filename.
14. Execute a command to run a script hello.sh at tea time.
15. Replace multiple spaces with a single space in file f1.
16. Write a unix command to evalute an expression : 4*3.14+6
17. write a command to display all unique words of file f1.
18. Write a command to locate lines that begin and end with (.).
19. write a command to display all lines that contains 2 or more ^ symbol at
     beginning of line.
20. Write a command to replace all occurrences of “he” with “she” and “hello” 
     with “hi” in file f1.
21. Display those lines having exactly 10 alphabates from file f1.
22. Copy file content of f1 to file f2 if f1 exist otherwise write error 
     message to file f2.
23. Search those files from current directory which have more than 5 links.
24. Display lines of file f1 that do not contain digit in it.
25. Replace all occurrences of “linux OS” with “unix OS” in file f1.
26. Display all line of file f1 having 3rd word as 'user'.
27. Display name of all files of working directory having pattern “The”.
28. Display lines of file f1 that begin with any capital letter.
29. Write a sed command to extract first word of each line. Assuming that 
    there is no white space     character at beginning of line.
30. What does the following command do?
grep f1 f2 f3
31. display only those lines of file f1 having length in between 30 to 50 
     characters.
32. Display binary value of 12 using bc.
33. Replace all occurrences of “hello” with “hi” and “he” with “she”.
34. Count number of words and lines of files whose filename begins with x.
35. Write equivalent sed command of “sed '1,5d' f1”.
36. Write equivalent IRE for the following regular expression
- A*
- A?