You are on page 1of 13

Short Questions.

(1) What is job? How can you move a job from the background to the foreground and vise versa? How ca we run them ? (2) tee command (3) Difference : $@ and $* (4) How to kill the last background job? (5) Use of grep command. (6) Explain pipe with suitable example. (7) Functions of kernel (8) Why file command is used? (9) Explain super block (10) Define process. Which process has PID 1? (11) Explain wait & sleep command. (12) why rm r command is dangerous? (13) Use of Touch command (14) Which file is parent of all files? (15) What do /etc directory conatin? (16) What is the use of ps command? (17) Significance of batch command. (18) Write a vi editor command to go to line numner 40. (19) Write a vi editor command to copy 10 lines. (20) Explain command mv* ../bin (21) Explain cp[!a-z A-Z]* progs. (22) Discuss the significance of expr & echo (23) Explain significance of tty (24) What is output of head n 5 f1 and tail +5 f1 command. (25) Explain remembered pattern of sed utility. (26) Explain matching operators of awk utility. (27) Differentiate between system variable of awk, FNR, NR. (28) Explain array in awk utility. (29) Give operations that you can perform on directories. (30) What are the three time stamps maintained in the inode and how do you display two of them for the file file1. (31) What is the difference between grep & fgrep? (32) Distinguish between process & job? (33) In which shell variable is the current shell process-id contained? (34) State the function of PATH variable. (35) Give any two circumstances when a directory file cannot be removed using the rmdir command. (36) State any two methods to stop incoming message being written to a terminal. (37) What is the purpose of export command? (38) List default file as well as directory permission when masking has been set by

the command as umask 333. (39) What is the function of getty process? (40) Differentiate : rm r dir1 and rmdir dir command. (41) List out the name of startup and shutdown files of any two shells. (42) Explain possible ways to protect files in directory. (43) Explain super block. (44) What is the purpose of IFS and PATH system variables? (45) What is redirection ? Explain I/O redirection metacharcters of shell with an example. List out the symbols used in redirection. (46) Define Process. Which process had PID number 1? List the different states of process. (47) How can you create soft link file? What are the advantages of soft link file? (48) How we can know the status of background jobs? (49) List the possible way to know that terminal of other user are write protected or not. (50) What do you mean by internal and external command in unix? (51) Which is the only file attribute not stored in the inode? Where is it stored then? (52) How does the administrator ensure that all files created by users will have the default permission rw-rw? (53) Which file attribute change when you copy a file from another user account? (54) Which process creates getty process? What is the responsibility of getty process? (55) What is the importance of script command? (56) List out the characteristics of Unix file system? (57) Explain matching operators of awk utility with an example. (58) Compare grep & egrep (59) Explain delete(d) and write(w) operators of sed utility. (60) Explain the meaning of the following command : grep * f1. (61) If x has the value 10, what are the values of x$x$ and $x$x? (62) What is the exit status of a command? What is its normal value, and where is the value stored? (63) Differentiate between while and until loop. (64) Give two functions of the dot ( . ) in vi editor. (65) What is the function mv command? (66) List out the startup files used by bash shell. (67) State the difference between utility and application. (68) how do you create a subshell? How do you move to the parent shell after creating a subshell? (69) Format a file named f1 such that the file have 5 characters left margin and should be display in 3 columns. (70) Explain the meaning of following command. Cat file1 | | echo File1 not found (71) State why the r option of rm is dangerous. (72) What is meant by and minor number? (73) How do character devices and block devices differ? (74) What does the following command do? ls l | sed n /^./{5,8\}w\p

(75) What is the significance of OFS ? Give example. (76) What does the following command do? grep f1 f2 f3 (77) Write a grep command to display all files of current directory that contains unix pattern in it. (78) Write a sed command that places contents of file f2 at the beginning of file f1. (79) Write a sed command to select those lines between 25 to 40 having pattern unix in a file f1 (80) Which two operators used to match string with a specific field in awk? Give example of it. (81) Give at least four operations we can use uniquely with directories. (82) What do you mean by block & character special devices? (83) What is the role of login program? (84) How can you know the location of a command line? (85) Is the option really optional? Justify your answer with an example. (86) Where is the password stored? (87) How will you record your login session in the file x1? (88) Where are the system administrations commands and configuration files stored? (89) List at least two commands that do not create process. (90) Which vi editor command moves cursor to the beginning of line? (91) Which ls option marks directories and executables files separately? (92) What is the difference between yank and delete in vi editor? (93) Define process. Which process do you think may have the maximum number of children? (94) Which processes can not be killed using kill command? (95) What is the purpose of special files /dec/null? (96) When do wildcard characters lose their meaning? (97) How can you make out whether two files are copies or links? (98) You removed the write permission of a file from group and others and yet someone (other than super user) could delete your file. How could that happen? (99) What do you mean by command substitution. (100) Define internal & external commands of unix. (101) When is it appropriate to schedule a process using at command? (102) What is the importance of regular expression? (103) What does $$$*$ pattern match? (104) How will you remove duplicate lines from a file? Assume that file is unsorted. (105) Define file system. (106) What does /lost+found directory consists of ? (107) Define Home directory. When home directory and working directory same? (108) How you can prevent yourself from messages send to you while you are working through online communication utilities? (109) What does /dev/null file returns when reading from it? (110) What is major device number? (111) Define daemon. Is init is a daemon process? (112) Why mounting of a file system in necessary? (113) What are the two ways provided by vi editor to go to end of file?

(114) When export command is useful? (115) is i-node table store filename also? (116) List at least two internal as well as two external shell commands. (117) Write regular expression equivalent to x+; (118) What is the purpose of END section of awk utility? (119) What is the purpose of index() function of awk utility? (120) How test command is used to check that given argument is directory or not? (121) List at least two online communication command. (122) Differentiate between $@ and $* (123) Which process listen the login request? (124) Explain : cat x1> x2 2 > x2 (125) Explain : (date; cat x1) > x2 (126) Explain : expr -50 % 5 (127) Explain : egrep (ab|cd)xy x1 (128) Explain : umask 000 (129) Explain : cur d:f1 /etc/passwd (130) Explain : awk {print} x1 (131) Explain : awk $2 ~ /^[A-Z]/ {print $2} x1 (132) Explain : sed /xyz$/q x1 (133) Explain : sed s/ab/xy/ x1>x2. (134) What will happen for the command cat x1 > x2 when file x2 exists and do not have write permission? (135) What is the purpose of i-node table? (136) Define environment variable. What is the scope of a variable by default? (137) Which permissions for working directory are necessary for executing rmdir command successfully? (138) Suppose your working directory is x1, which is linked to x2 and both are under /usr/bca01. What will be output of pwd command? (139) What can be size in terms of byte of newly created directory? Further how many files will be created initially when you run mkdir command? (140) Explain kill command with example. (141) Explain characteristic of unix file system. (142) What do you mean by daemon process? List out them. How will you kill a daemon? (143) Explain here document. (144) Explain concept of sticky bit. (145) Explain the use tee command. (146) State the use of the shell variables PS1 and PS2. (147) List out the functions of kernel. (148) What is the difference between following commands. (1) (cd dirl;pwd) (2) {cd dirl;pwd;} (149) What is the size of each entry in the inode table? (150) How will you schedule a process, which should wish you happy birthday on each of your birthday throughout the rest of your life? (151) Which is the process that listens on every terminal for login request? (152) How can you copy a file while preserving the attributes?

(153) How will you find out the users who are idling? (154) Set ready the way as along with How can you print last arguments of positional parameter (do not use $1, $2. $9 ) (155) Give at least two way to delete a current line in vi editor. (156) Differentiate between system variable NR and FNR of awk utility (157) What does the following command do? Sed s/echo/ECHO/gw out x1> x2 (158) List out some additional special characters used by egrep but not by grep. (159) Interpret following command. grep ^[^^] file1 (160) What is job? How can we suspend a foreground and background job? (161) Define Filter? List the name of filter utilities. (162) How can we assign value of 12th positional parameter to a variable? (163) What are the two different ways to display login shell of the user? 164) What permission is needed in a directory so that everybody can list the contents of the directory? (165) What is metacharacter? Give at least two uses of the single quote () notation. (166) What is the purpose of/bin directory of unix file system? (167) What is the difference between scheduling processes using batch command and using at command? (168) How can we access command line arguments through awk script? (169) How many fields are in each entry of the /etc/passwd file? Give their name. (170) What does the following command do? (1) grep shell file1>f1.out && cat f1.out || echo pattern not found (2) (cd mydir1;pwd) # assume that working directory is/home/bca1 and mydir1 (3) nice cat student.dat (4) nohupcat * | sort d & (5) set who am I echo $1 (6) awk NR==5 && NR==10 {print $0} f1 (7) expr red hat linux : *

Write commands
(1) To delete every; at end of file in file f1. (2) To display all lines, not containing printf in file f1. (3) To print first three columns and first two rows of file f1. (4) To display lines by replacing echo with printf in file f1. (5) To print line number of all lines begins with T in file f1. (6) To delete all lines begins with T in file f1. (7) To display all lines but not the last line of file f1. (8) To extract first word of each line of file f1. (9) To replace the with he and bad with good (10) To display all lines that contains pattern g* in a line. (11) Display all files of current directory whose 1st character is not special character. (12) Remove directory tree-structure dir/dir2/dir3 using single command. (13) Count the frequency of users who are logged-in from more than one terminal. (14) Frame a crontab entry to execute command1 every minute in first 10 minutes after 5:00 pm every Friday of the month march , june, September and December of every year. (15) Opens most recently save file in vi editor. (16) Delete all leading and trailing spaces in all line of a file f1. (17) Select those lines that contain only digits. (18) Display all line that start with let from a file x1.1,e or t may be in any case. (19) Count the frequency of each word in text file. (20) Display string in uppercase. (21) Write a command using awk utility. (1) Simulate the following shell commands. (1) tail -40 file1 (2) head -20 file | tail -6 (2) list regular files that consist of exactly five words in at least one of the line. (3) Display all words in file1 that begins with digit. (4) Print odd number of words in each line. (5) Count occurrences of pattern unix in file f1. (6) Display those words whose length greater than 8 characters and consist of alphabet only. (22) Write a grep command to display all lines that begin and end with same character. (23) Using command substitution, write a command sequence that always prints the calendar of the current month. (24) Give special notation used for following directories. (1) root (2) Parent (3) Child (4) home.

(25) What are the conditions that need to be satisfied to make this sequence work? Command1 | Command2 | Command3 (26) How will you store the size of file1 in variable cnt ? (27) Name the three sources of standard input and output. (28) Consider the following code. Which display message pattern found. If f1 contain hello pattern otherwise display message pattern not found if grep helo > f1>/dev/null then echo pattern found else echo pattern not found fi Write a command that is equivalent to above code. (29) Frame a command to locate all the .doc and .txt files in the system. (30) Change modification time of a file to Dec 25, 10:30 am. (31) List all files of working directory having at least 4-characters in filename. (32) Frame a command to run the script hello.sh at teatime. (33) Display all files recursively (including the hidden ones) in multiple columns with distinguishing makes on executables and directories. (34) Replace multiple spaces with a space in file f1. (35) write a command to evaluate the expression : 4*3.14+6 (36) Write a command to display all unique words of file1. (37) Consider the file emp.dat having fields emp_no, ename(firstname lastname), designation , department, joining date(dd/mm/yy) and salary, each fields separated by /. Solve the following queries using awk utility (1) Find out name and designation of youngest person who is not a director. (2) how do you add the century to the date field of emp.dat? (3) Invert the name of the persons in emp.dat so that the last name occurs first. (4) Display name of the persons in emp.dat whose salary between 10000 to 25000. (5) Count frequency of designation in emp.dat file. (38) Write a command to locate lines that begin and end with a dot and containing anything between them. (39) Write a command to display all lines that contains 2 or more ^ symbol at beginning of file. (40) Find out the complete command line of process run by user user1. (41) Write a command to display all filename containing only digits in a filename. (42) Fine the users who are not using the terminal tty2, tty3, tty4. (43) Extract the names of the users from /etc/passwd after ignoring the first entries. (44) Find out the number of times the character ? occurs in a file. (45) Add /home/bca/progs to your existing PATH. (46) Convert the decimal number 192 to hexadecimal. (47) Display files that have been modified in less than two days.

(48) Display all files in current directory where the first character is numeric and the last character is not alphabetic. (49) Write a sed command to display lines 5 to 10, 15 to 20 and last lines of file f1/ (50) Write a sed command to extract first word of each line. Assuming that there is no white space character at beginning of line. (51) Write a command to display all line but not the last line of file. (52) Write a command to display filenames of working directory having first and last character must be an alphabet. (53) Write a command to list the users logged in more than once. (54) Write a command to display all files having length greater than equal to 25 characters. (55) Write a command to display system processes. (56) To replace all occurrence of word zenix with word unix but only on those lines where the word operating found in file INFILE. (57) To display those lines between 25 to 50 having pattern unix in it. (58) To replace multiple spaces with a space. (59) To select files having read and write permission for all categories of users (60) To display those lines that contain two or more consecutive instances of any word. (61) To count number of characters on last line of file x1. (62) Display those lines of the file emp.dat in which third field contain director or chairman. (63) Display from /etc/passwd a list of users and their shells for those using the korn shell or bash. (64) To locate lines that contain hardware, software or firmware. (65) To count all lines that end with digit. (66) Display regular files having more than two links. (67) Display number of words and lines of files whose filename begins with x. (68) Replace the word unix with UNIX in between 5th to 10th lines including both. (69) Remove all leading spaces from a file f1. (70) Display lines from file x1 that contains at least 10 characters. (71) Display line number before each line. (72) Move files that begin with x from current directory to the /usr/bca01 directory. (73) Display only regular files of working directory. (74) Remove directory tree dir/dir2/dir3 using single command. (75) Assign values of 10th positional to a variable x. (76) Display lines 10 to 15 from file x1. (77) Display last word of each line from a file x1. (78) Equivalent sed command of sed 1,5dx1. (79)Display lines before a line that contains pattern xyz. (80) Multiply value of variable x with that of y and store the result in variable x. (81) Write a command to count number of special characters in a file. (82) Write a command to display all filename containing only digits in a filename. (83) Write a unix command which is similar to msdos command del *.*/p (84) Write a command to move all files begins with digit, from parent directory to the current directory. (85) Write a vi editor command to move two lines from the beginning of a file to the end.

(86) Write a command to link non-existing file nonfile.sh with newfile.sh. (87) Write a sed command which add two spaces to the begging of each line and two dashes to the end of each line. (88) Write an awk command that display all lines having 2nd and 3rd characters same. (89) Write a command to append blank line after each line in a file except last line. (90) Write a grep command which print all lines except the comment line of shell script. (91) Write a grep command to display all files which have read and write permission for the group. (92) Write a sed command to replace unix os on lines 5th to 10th . (93) Write a vi editor command for the following. (1) copies all lines from current line to end of line. (2) Repeat last editing instruction. (94) Display contents of last modified file. (95) Display attributes of directory dir1 reside in current directory. (96) Display only those users who are currently logged in from more than one terminal with same user-id. (97) Kill all the processes including the login shell. (98) Copy the content of file f1 to f1.out if f1 exist otherwise write error message to same file ( i.e. f1.out) (99) Search in current directory downwards all files which have more than 5 links. (100) Split existing window in vi editor into two separate windows. (101) Count number of words and characters of working directory files that end with digit. (102) Create an empty file in/usr/dir1 directory from working directory. (103) Creates an output file from file f1 that contains only the lines in which one of the 5 characters words must be palindrome. (104) Answer the following using grep, sed or awk utility. (1) replaces all occurrences of unix with linux in 5th line of file f1. (2) count all occurrences of unix in file1. (3) Display all lines of file f1 but not last line. (4) Do not display blank lines of file f1. (5) Replace kernel with kernel architecture using remember pattern of sed utility.

Short Notes:
(1) Features of Unix Operating System. (2) Online Communication Command. (3) Explain For loop with example. (4) Pattern Matching feature of grep. (5) Explain I-node Block. (6) Explain Redirection using example. (7) Explain sort command with its any three option with example. (8) Explain chmod with changing relative file permission & absolute file permission. (9) Explain Sticky Bit (10) Steps interpreted by shell at Unix prompt. (11) Show the octal representation of following permissions (1) r-xr- - r-x (2) -wxr - - - wx (12) Explain the function of each mode of vi editor. How can we switch from one mode to another mode? (13) What will be the permission string for following octal values? (1) 570 (2) 406 (14) Explain the function of /dev and /etc directories. (15) What is regular expression ? Explain any one utility with proper illustration that uses regular expression. (16) Define a shell. Explain with an example the meta-characters that the shell uses to match filenames. (17) What is filter? List out the four categories of filter command. (18) What is IRE ? Explain in brief with an example. (19) What is here document? What are the advantages of it? Give proper illustration. (20) What is a hidden file in unix? How do you remove only the hidden files from your current directory? (21) Explain substitution feature of sed utility (22) what is command substitution ? Distinguish between command substitution and piping. (23) Discuss string functions of awk utility. (24) What is Shell? Explain the features of shell. (25) Explain fsck utility. (26) Explain quoting and filename-substitution metacharacters of shell with an example. (27) Explain editing commands of vi editor. (28) Explain sort command with its options giving example of each. (29) Explain here document with proper illustration. (30) Explain how you use egrep and fgrep to take patterns from a file. Give an example of each. (31) Differentiate between screen and line editor. Explain operators used in vi editor. (32) Explain for loop with and example. (33) Discuss various options of backup and recovery command. (34) Name six administrative functions that cant be performed by a non-privileged user.

(35) Give the significance of special parameters used by shell. (36) Which two symbols do not lost their meaning when enclosed within double quote? Explain with example. (37) What is the purpose of following command. (1) head n 5 file1.txt | tee file1.out (2) ls *.[!co] (3) awk NR = = 5, NR = = 10 { print$0 } f1 (38) Explain default directory structure created during the installation of unix OS. (39) Explain shell meta character with example. (40) Explain one command used for backup and recovery. Discuss its various options. (41) Explain position parameters with an example. (42) Distinguish between a sequence of commands, a group of commands and a chain of commands. (43) Explain access permission for directory and file. (44) Explain set commands of ex mode of vi editor. (45) Explain TRE features of sed with suitable example. (46) Explain arithmetic functions available with awk utility. (47) Locate lines where the occurrences d of any three consecutive and identical (e.g aaa , bbb .. ) using (1) grep (2) sed (48) State the significance of the following built in variable of awk utility. (i) FILENAME (ii) NF (49) Explain any two commands used to compare the contents of files. (50) Discuss different type of files available undex Unix system. (51) How command substitution and piping mechanism differ from each other ? explain with example. (52) Explain grep utility with example. (53) Write a short note on memory management in unix. (54) The cp command and cat command with redirection is used to copy the content of file. Discuss when you prefer which alternative. (55) Define file system. List few file system that are supported by linux. Also list few common characteristics provided by most of the file system. (56) Define process. How it differ from executable program? List different process state available under unix. (57) Explain disadvantages of vi editor. (58) Explain case structure in unix. (59) Explain any two communication command. (58) Short note on conditional parameter substitution. (58) Explain the purpose of following files/directories (1) /lost+found (2) /bin (59) Explain remembered pattern of sed utility. (60) Explain significance of system variable used with awk utility. (61) Explain concept of array in awk utility. (59) Explain egrep with an example that uses some special characters not used by grep. (60) Explain different security levels in unix operating system. (61) Explain job control features of a shell.

(62) Discuss various modes of vi-editor. List out cursor movement command provided by vi- editor. (63) Discuss the kernel architecture of unix system. (64) Explain kill command. What are the advantages & limitation of background process? (65) Differentiate between redirection and piping mechanism. (66) Unix is an open system (67) Explain pattern matching features of egrep utility. (68) Explain array feature supported by awk utility. (69) Distinguish between user defined and predefines variable. How can we create variables in shell?

Commands:
nice cmp rm nohup sort At comm. Pr shift mkdir touch diff bc kill wait write test tr tee wall eval mail sort nl cut

Script:
(1) A script to perform the following operation on two inputted numbers. Inputted numbers should be either an integer or a floating point or both. Make proper validation. (1) Addition (2) Subtraction (3) Multiplication (4) Division (2) A script that receive string and check both are same or different. Also check the length of both strings are greater than 0. (3) A script to enter 5 subjects mark from command line and display percentage & appropriate class. (4) Write an awk script that accept values of two MxN matrices and display multiplication of these matrices. (5) Write a script that accept username from command-line and check after every oneminute whether user has logged in or not. The script should display message on users terminal whenever he logs in. (6) Write a script to simulate wc command of unix. (7) Write a script to read a file contents and count number of consonant, vowels, digits , special characters and white space charcters. (8) Write a script that receives any number of filenames as argument and then count number of consonants, vowels, digits and special characters in each file. (9) Write a script using awk utility to create two 3x3 matrices and multiply it. (10) Write a script to take two numbers as argument and output their sum using bc. Include error checking to test whether two arguments were entered and they are

valid or not. (11) Write a shell script to simulate head command of unix. (12) Write a script that accept amount, rate of interest and year from user. Use bc to calculate simple interest. Appropriate data validation is expected. (13) Write an awk script that count frequency of one, two, three, four and more than four characters word in a file. (14) Write an awk script to print the file myfile.txt. The output should be such that there should be such that there should be only 25 characters in each line. If a line in the file exceeds 25 characters the remaining characters should be printed in the next line. (15) Write an awk script that calculates frequency of palindrome words in a text file. (16) Develop a shell script that creates 100 files with the bca001 up to bca100. (17) The distance between two cities (in kms) is input through the keyboard. Write a shell script to convert it in meters, feets, inches and cms. (18) Write a shell script that output number o words that begins with capital alphabet followed by filename for each file given as command line argument. Necessary validation is expected. (19) Write a shell script that output filename followed by granted permissions of only those files having same permission for both owner as well as group. (20) Write a script that merges two files alternatively in reverse (i.e last lines of two files, second last line of two line so on) (21) Write a script that removes only empty files from current directory. (22) Write a user defined function using awk utility to simulate left() of basic. (23) Write a shell script that accept filenames and a number N from command line and display last n-lines of each file ( Do not use tail command ) (24) Write an awk script to display file contents in reverse (i.e last line should be display firstfirst line should be display last) (25) Consider the stud.dat data file having fields stud_no, name , city and state. Each file separated by |. Write a menu driven script to perform following task. (1) Append record to a data file. (2) Delete a record from a file (3) Display recort city wise (26)

You might also like