Question Bank ON Unix & Shell Programming-502 (Core Paper-2)
Question Bank ON Unix & Shell Programming-502 (Core Paper-2)
Question Bank ON Unix & Shell Programming-502 (Core Paper-2)
QUESTION BANK
ON
UNIX & SHELL PROGRAMMING-502 (CORE PAPER-2)
TOPIC 1: VI-EDITOR
S.NO: QUESTION
1. Display two lines starting from 7th line of file X1.
2. Display all blank lines between line 20 and 30 of file X1.
3. Display lines beginning either with alphabet or digit fro file X1.
4. Display the line that do not contain “unix”
5. Display the lines which are not starting with 2 at the beginning.
6. Write a command to replace ‘UIX OS’ ON LINE NO 5TH TO 10TH.
7. Write a command to display all file name containing only digits in a filename.
8. To list file names consist of only 4 digits.
9. To display lines beginning with alphabets of a file X1.
10. To count number of words in line 40 through 60 of file f1.txt
S.NO: QUESTION
1. Display the lines which are not starting with 2 at the beginning.
2. Display lines having exactly 50 characters of file X1.
3. Count number of blank lines in file X1.
4. Display lines having at least one * character in file X1.
5. Display lines from file X1 that containing string “UNIX” or “unix” or “Unix”
6. Display the directory listing.
S.NO: QUESTION
1. Write a command to print lines which contain ‘Accounts’.
2. Write a command to print lines which do not contain ‘Accounts’
3. Write a command to print line 10 to 15
4. Write a command to substitute ‘doshi’ with ‘desai’
5. Write a command to print lines with line numbers which contains ‘Marketing’
6. Write a command to display line which starts with “the”
S.NO: QUESTION
1. Substitute ‘endif’ with ‘fi’ on line 10 of file X1.
2. Display two lines starting from 7th line of file X1.
3. Display all lines before string Unix from file X!
4. Display all blank lines between line 20 and 30 of file X1.
5. Display lines beginning either with alphabet or digit from file X1.
6. Display the lines that do not contain “Unix”.
S.NO: QUESTION
1. To display all lines that contains pattern ‘bc*’ in a line
2. To locate lines where second and second last character of file f1 are same
3. To replace ‘tybca’ with ‘TYBCA’ in input file ‘in.sh’ and write those lines to output
file ‘out.sh’
4. To replace all occurrence of ‘she’ with ‘he’ and ‘hi’ with ‘hello’
5. To locate lines that begin and end with .(dot)
6. To display line 5 to 15, 25 to 35 and last line of file f1.
S.NO: QUESTION
1. Write a command to print first seven line of file.
2. Write a command to sort a line of file and also remove a repeated line.
3. Replace all occurrences of ‘SYBCA’ with ‘TYBCA’ in 5th line of file f1.
4. Count all occurrence of ‘tybca’ in studlst.
5. Replace ‘kernel’ with ‘kernel architecture’ using remember pattern of sed utility.
6. To run a utility x1 at 9:00 AM.
7. Write a command to locate the ‘Unix’ ignoring case.
8. Write a command to display occurrence of string ‘tybca’.
9. Write a command to display line, which start with “the”.
10. Write a command to display line, which ends with ‘India’.
11. Write a command to print first six line of file.
S.NO: QUESTION
1. Display lines 10 to 15 from file x1.
2. Display last word of each line from a file x1.
3. To count number of characters in last line of file x1.
4. To count number of words in line 40 through 60 of file f1.txt.
5. To delete all special characters from file x1.
6. Display all line that start with ‘let’, from a file x1.
S.NO: QUESTION
1. To remove duplicate line from a file
2. To count number of characters in last line of file X1.
3. Display the processes of user ‘bca0 I’
4. List the user from /etc/passwd in the alphabetically sorted order
5. Count the frequency of users who are logged in from more than one terminal
6. Display string in upper case of the file f1.txt.
S.NO: QUESTION
1. Count number of characters in first five lines of file X1.
2. To replace the word computer with computing of file x1.
3. Display lines whose last word is Unix of file x1
4. Display lines starting from 10th line to the end of file X1
5. To delete all special characters from the file X1.
6. To display lines beginning with alphabets of a file X1.
7. To remove a file name as X1?(X1 followed by ? character)
8. To run script X1 in background so that its execution continues even user logout from
the system.
9. To display last line of a file X1.
10. To deny execute permission to a group of a file X1.
11. To create link between file X1 and X1.link
S.NO: QUESTION
1. To print first three lines of file tybca.
2. To sort file by last access time
3. To print field 1 and 6 from file tybca
4. To print unique line of file tybca
5. To print frequency of each line from file tybca
6. To find file having size greater than five
7. To find a file having .c extension
1. Write a command to print line which contain tybca on file dept.lst
2. Write a command to print lines which not contain tybca
3. To print line 6 to 12
4. To replace first occurrence of surat with vyara in each line
5. To print content of file after deleting every ;
6. To sort on 3 column to 5 column
7. To convert small alphabets to capital
8. To print lines with line number which contain ‘Marketing’
S.NO: QUESTION
1. Forcefully delete each file from directory tybca/my work
2. Show all hidden files from mydir/tybca
3. Sort filename by last access time from directory tybca/mywork
4. Rename file chap 1 to unit 1
5. Find out number of lines of file chap01
6. Find out inode number of file chap01
1. write a command to sort a line of file and also remove repeated line
2. Command to locate the tybca ignoring case
3. Command to display occurrence of string ‘Sale’
4. Command to display line which start with ‘the’
5. Command to display line which end with ‘ia’
6. Command to print first three lines of file
7. Command to substitute ‘doshi’ with ‘desai’
S.NO: QUESTION
1. Write a command to display all words in file 1 that begin with digit
2. To display total number of words and lines of files for which file name start with ‘m’
3. To remove all leading space from a file f1
4. To display line number before each line
5. To display line 10 to 20 from file f1
6. To remove3 dir. Tree dir1/dir2/dir3 using single command
7. To move all files begin with digit from the parent dir to current dir
8. To convert decimal number 192 to hexadecimal
9. To give read and write permission to file f1
10. To change modification time of a file f1 to dec 01 10:30 am
11. To display all unique words of file f1
S.NO: QUESTION
1. print odd numbers of words in each line
2. Print lines no 18 to 30 from file f1.txt.
3. Count the total no. of lines in a file.
4. Count occurrence of pattern ‘Unix’ in file f1.
5. Print lines, which end with 5, 6, and 7 from, file f1.
6. Write a script to print 1 to 10 nos.
7. Write a command to print those lines where field2 is computer field 3> 15000 from
sales file.
8. Display those words whose length is greater than 8 characters and consist of alphabet
only
.
S.NO: QUESTION
1. Print even numbers of words in each line.
2. Count occurrence of pattern ‘operating system’ in file f1.
3. Display those words whose length greater than 10 characters and consist of alphabet
only
.
TOPIC 11.3 : 2014 nov./dec.
S.NO: QUESTION
1) Write awk script to display the user login ids, their home directories and login shells
from the “/etc/passwd” file.
2) Switch the first two fields in each line of a text and put the result in a new file
3) To only print lines wherein the first field had a numeric value of less than 20
4) Write script using awk utility to display files contents in toggle case. Assume that file
should be passed from command line.(8)(2010)
S.NO: QUESTION
1. To count number of occurrence of pattern ‘bca’ in file f1
2. To print words whose length is greater than 4 characters and consist digits only
3. To print even number of words in each line
S.NO: QUESTION
1. Write script using awk utility to display files contents in toggle case. Assume that file
should be passed from command line.(5)
2. Write a script that removes all empty files in current working directory. Appropriate
data validation is expected.(3)
do proper validations
Write a script that removes all empty files in current working
15. 5 2010
directory. Appropriate data validation is needed.
Write script to enter 5 subjects marks from command line and
16. 4 2010
display % and appropriate class
Write script to check entered character is uppercase lowercase
17. 4 2010
numeric digit or special character
TOPIC 13 : COMMANDS
How you use egrep and grep to take pattern from a file? give
46. 5 2011
example
47. Mail command 4 2011
2011/20
48. Significance of sleep and wait command. 2
10
49. Cut and paste command 2 2011
2011/20
50. Why ‘file’ command is used 2
10
51. Why ‘test’ command is used 2 2011
52. Output of tail –20 file 1 2 2011
2010,20
53. Write and eval 2
10oct
54. Use of test statement 2 2010
2010,20
55. Explain online communication commands 4/4
10oct
2010/20
56. batch command 2/3/3/3 14/2013/
2011
57. Explain command mv* ../bin 1 2010
58. Explain cp[!a-zA-Z]* progs. 1 2010
59. Explain significance of ‘expr’ and ‘echo’ 1 2010
60. Explain significance of ‘tty’ 1 2010
61. What is output of head –n 5 f1 and tail +5 f1 command 1 2010
2010/20
14/2013/
62. at command 1/3/3/3/3
2011/20
10
63. Why -r option of rm command is dangerous 2 2010
64. grep command use 2 2010
2010/2
010 oct
9. What information contained by $? And $# variable? 2 2014
What will be the output of following code:A=’expr –5%2’ echo
10. 2 2011
$A
What is exit status of a command? What is its normal value, and
11. 2 2014
where is the value store?
12. Explain conditional parameter substitution giving example 5 2012
2012/2
13. What do you mean by pipe give example 2
010
2012,2
14. Remembered pattern and repeated pattern 5
010
15. Explain pipe 1 2011
What is regular expression? Explain any one utility which use
16. 5 2011
regular expression, with proper example
17.
How command substitution differs from piping mechanism?
18. 2 2010
Explain with example
19. Explain booting sequence of Unix OS. 4 2010
What is difference between screen and line editor? List any two
20. 1 2010
names of line and screen editor
What is regular expression? Write a regular expression that
21. 2 2010
matches comment line of c program
22. Explain different role of ^ in regular expression. 2 2010
23. Explain features of Unix OS. 6 2010
Explain remembered pattern and repeated pattern giving suitable
24. 6 2011
example.
25. Give significance of following system variable HOME,PSI 2 2010
26. Explain find operator in detail 5 2011
27. Features of UNIX OS 5 2011
Which attribute change, when* you copy a file from another user
28. 1 2011
account
29. Significance of FSCK utility 1 2011
30. Detail note on FSCK utility of Unix 6 2011
2011/2
31. Purpose of sticky bit 2
010
32. Differentiate > and >> 2 2011