Unix Questions - Part 1


1.  Which symbol will be used with grep command to match the pattern pat at the beginning of a line?
A.            ^pat 
B.            $pat
C.            pat$
D.            pat^
E.            None of the above
Ans: Option A

2.  Which command is used to sort the lines of data in a file in reverse order
A.            sort
B.            sh
C.            st
D.            sort -r
E.            None of the above
Ans: Option D

3. Which command is used to display the top of the file?
A.            cat
B.            head
C.            more
D.            grep
E.            None of the above
Ans: Option B

4. Which command is used to copy all files having the string chap and any two characters after that to the progs directory?
A.  cp chap?? progs
B.  cp chap* progs
C.  cp chap[12] /progs/*.*
D.   cp chap?? /progs/*
E.            None of the above
Ans: Option A

5.  Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3?
A.            chmod u+x emp[l-3]
B.            chmod 777 emp*
C.            chmod u+r ??? emp
D.            chmod 222 emp?
E.            None of the above
Ans: Option A

6. Which command is used to remove a directory?
A.            rd
B.            rmdir
C.            dldir
D.            rdir
E.            None of the above
Ans: Option B

7. Which of the following keys is used to replace a single character with new text?
A.            S
B.            s
C.            r
D.            C
E.            None of the above
Ans: Option B

8. Which command is used to extract specific columns from the file?
A.            cat
B.            cut
C.            grep
D.            paste
E.            None of the above
Ans: Option B

9. Which command sends the word count of the file infile to the newfile.
A.            wc infile >newfile
B.            wc <infile >newfile
C.            wc infile - newfile
D.            wc infile | newfile
E.            None of the above
Ans: Option A

10. Which command is used to remove the read permission of the file 'note' from both the group and others?
A.            chmod go+r note
B.            chmod go+rw note
C.            chmod go-x note
D.            chmod go-r, 4-x note
E.            None of the above
Ans: Option D



Comments