UNIX MCQ SET


[1] Which command is used to sort the lines of data in a file in reverse order
(A) => sort
(B) => sort -r
(C) => sh
Answer =>> sort -r

[2] Which command is used to display the top of the file?
(A) => cat
(B) => head
(C) => more
Answer =>> head

[3] 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/*.*
Answer =>> cp chap?? progs

[4] 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
Answer =>> chmod u+x emp[l-3]

[5] Which command is used to remove a directory?
(A) => rd
(B) => rmdir
(C) => dldir
Answer =>> rmdir

[6] Which of the following keys is used to replace a single character with new text?
(A) => s
(B) => S
(C) => C
Answer =>> s

[7] Which command is used to extract specific columns from the file?
(A) => cat
(B) => cut
(C) => grep
Answer =>> cut

[8] Which command sends the word count of the file infile to the newfile.
(A) => wc infile >newfile
(B) => wc newfile
(C) => wc infile - newfile
Answer =>> wc infile >newfile

[9] 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-r, 4-x note
Answer =>> chmod go-r, 4-x note

[10] Which of the following commands is used to display the directory attributes rather than its contents?
(A) => ls -1 -d
(B) => ls -1
(C) => ls -x
Answer =>> ls -1 -d

[11] Which of the following commands is used to display the directory attributes rather than its contents?
(A) => ls -1 -d
(B) => ls -1
(C) => ls -x
Answer =>> ls -1 -d

[12] Which of the following files will displayed by this command cat *ch*
(A) => patch
(B) => catch
(C) => All of the above
Answer =>> All of the above

[13] The Octal number to be given alogn with chmod command to make a file readable, writable and executable to the owner, readable and executable to group and others is:
(A) => 000
(B) => 755
(C) => 744
Answer =>> 755

[14] If you are to use [Control-c] as the interrupt key instead of [Del], then you will have to use
(A) => tty ^c
(B) => stty intr \^c
(C) => stty echoe
Answer =>> stty intr \^c

[15] Which of the following is not a communication command.
(A) => write
(B) => grep
(C) => mail
Answer =>> grep

[16] Which of the following keys is used to move the cursor to the end of the paragraph.
(A) => }
(B) => {
(C) => $
Answer =>> }

[17] Which command is used to concatenate all files beginning with the string 'emp' and followed by a non-numeric characters?
(A) => cat emp[!0-9]
(B) => more [emp][!0-9]
(C) => cat emp[x-z]
Answer =>> cat emp[!0-9]

[18] The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is
(A) => tee
(B) => tr
(C) => sort
Answer =>> tee

[19] Which command is used to remove a file?
(A) => remove
(B) => rm
(C) => mv
Answer =>> rm

[20] Which symbol is used to separate more than one command in the same command line?
(A) => $
(B) => #
(C) => ;
Answer =>> ;

[21] The agency that sits between the user and the UNIX system is called the
(A) => logic
(B) => profile
(C) => shell
Answer =>> shell

[22] Which of the following commands is used to update access and modification times of a file?
(A) => grep
(B) => wc
(C) => touch
Answer =>> touch

[23] Which command is used to count just the number of characters in a file?
(A) => wc - 1
(B) => wc -c
(C) => wc -w
Answer =>> wc -c

[24] Which of the following commands is used to list contents of directories?
(A) => ls
(B) => lp
(C) => dir
Answer =>> ls

[25] Which command is used to display a file contents in octal form?
(A) => cd
(B) => od
(C) => of
Answer =>> od

[26] Which command will be used with vi editor to insert text to left of cursor?
(A) => s
(B) => a
(C) => i
Answer =>> i

[27] In vi editor, forward search is performed using the command.
(A) => :pat
(B) => ?pat
(C) => /pat
Answer =>> /pat

[28] Which of the following special shell variables is used to process number of the last background job?
(A) => $!
(B) => $#
(C) => $0
Answer =>> $!

[29] Which option will be used with ps command to slow the entire command line of the process being run?
(A) => -4
(B) => -f
(C) => -1
Answer =>> -f

[30] Which of the following command addresses all users who are currently hooked on?
(A) => write
(B) => mail
(C) => wall
Answer =>> wall

[31] Which option is used with rm command to make the command prompt the user with each filename and a ?, before acting on it
(A) => /usr
(B) => /etc
(C) => /tmp
Answer =>> /usr

[32] Which of the following commands is used to obtain a list of all files by modification time?
(A) => ls -1
(B) => ls -t
(C) => ls -i
Answer =>> ls -t

[33] The % key allows you
(A) => to move the cursor to a matching delimiter, when a delimiters a parenthesis, a bracket, or a brace.
(B) => to move the cursor to the upperleft corner of the screen
(C) => to move the cursor backward to the beginning of a word
Answer =>> to move the cursor to a matching delimiter, when a delimiters a parenthesis, a bracket, or a brace.

[34] Which command is used to display the characteristics of a process?
(A) => pid
(B) => du
(C) => ps
Answer =>> ps

[35] Which of the following commands is used to identify the type of file by context?
(A) => ls
(B) => cat
(C) => file
Answer =>> file

[36] The filed separator in cut command is specified with
(A) => -a option
(B) => -d option
(C) => -r option
Answer =>> -d option

[37] Which of the following options will be used to display number of blocks used by a file?
(A) => -c
(B) => -d
(C) => -s
Answer =>> -s

[38] Which option will be used with touch command to change the access time?
(A) => -a
(B) => -b
(C) => -t
Answer =>> -a

[39] Which command is used to make all files and sub-directories in the directory (progs) executable by all users?
(A) => chmod -R a+x progs
(B) => chmod -R 222 progs
(C) => chmod -1 a+x progs
Answer =>> chmod -R a+x progs

[40] Which command is used to display and create files?
(A) => cat
(B) => vi
(C) => ed
Answer =>> cat

[41] The second set of the three permissions (r-) indicates that
(A) => group has read permission only
(B) => other has read permission only
(C) => owner has read permission only
Answer =>> group has read permission only

[42] Which column contains all details of the permissions of a file when you issue the ls -l command?
(A) => third
(B) => fourth
(C) => second
Answer =>> third

[43] Which of the following commands is used to display your working directory?
(A) => dir
(B) => prompt $p$g
(C) => pwd
Answer =>> pwd

[44] While working with mail command, which command is used to save mail i a separate file?
(A) => s
(B) => r
(C) => t
Answer =>> s

[45] The command used to compare the files is known as
(A) => comp
(B) => cmp
(C) => do
Answer =>> cmp

[46] Which command is used to terminate a process?
(A) => kill
(B) => cancel
(C) => haltsys
Answer =>> kill

[47] Which option will be used with sort command to start sorting ofter the nth column of the (m+l)th field?
(A) => -m.n
(B) => +m.n
(C) => + n.m+1
Answer =>> +m.n

[48] The cp command uses:
(A) => standard input file
(B) => standard output file
(C) => neither standard input nor standard output file
Answer =>> neither standard input nor standard output file

[49] Which of the following files contains information related to password aging?
(A) => Shadow
(B) => password
(C) => profile
Answer =>> password

[50] Which command will be used with vi editor to replace text from cursor to right?
(A) => r
(B) => R
(C) => None of the above
Answer =>> R

[51] Which of the following commands is used to rename a file?
(A) => rename
(B) => remove
(C) => mv
Answer =>> mv

[52] Which of the following is not a filter?
(A) => cat
(B) => grep
(C) => wc
Answer =>> cat

[53] Which of the following commands is used to copy a file wb from the programs directory into a file called wbx in the misc directory?
(A) => copy programs/wb misc/wbx
(B) => cp programs/wb misc/wbx
(C) => tar programs/wb misc/wbx
Answer =>> cp programs/wb misc/wbx

[54] Which command is used to list all the files with extension .1st?
(A) => ls -l *.lst
(B) => ls lst*
(C) => ls *.*
Answer =>> ls -l *.lst

[55] Which option is used with the chmod command recursively to all files and sub-directories in a directory?
(A) => -1
(B) => -i
(C) => -R
Answer =>> -R

[56] Which command is used to change directory to the file beginning with a 'p'?
(A) => cd p
(B) => cd p*
(C) => None of the above
Answer =>> cd p*

[57] Which of the following is invalid filename?
(A) => shutry
(B) => TRY
(C) => None of the above
Answer =>> None of the above

[58] Which commands is used to assign executable permission to all of the files named "letter"?
(A) => chmod ugo+r letter
(B) => chmod ugo+rw letter
(C) => chmod ugo+x letter
Answer =>> chmod ugo+x letter

[59] Which set option is used with vi editor to display line numbers on screen?
(A) => nm
(B) => nu
(C) => ic
Answer =>> nu

[60] Which command is used to print a file?
(A) => print
(B) => prn
(C) => lp
Answer =>> lp

[61] Which command will be used with vi editor to replace single character under cursor with any number of characters?
(A) => s
(B) => a
(C) => i
Answer =>> s

[62] Which of the following set options is used with vi editor to ignore case while searching for patterns?
(A) => ic
(B) => ai
(C) => sm
Answer =>> ic

[63] Which command is used to list out all the hidden files along with the other files?
(A) => ls -l
(B) => ls -F
(C) => ls -a
Answer =>> ls -a

[64] Which of the following commands is used to absolutely assign all permissions to the owner, read and write permissions to the group and only executable permission to the others of the file note?
(A) => chmod 761 note
(B) => chmod 671 note
(C) => chmod 167 note
Answer =>> chmod 761 note

[65] The chmod ugo+rw note command can be represented in octal notation as
(A) => chmod 555 note
(B) => chmod 666 note
(C) => chmod 444 note
Answer =>> chmod 666 note

[66] Which of the following commands is used to display the filenames in multiple columns with indication of directories and executable file?
(A) => ls -F -x
(B) => ls -l
(C) => ls ~ x
Answer =>> ls -F -x

[67] Which command is used with vi editor to search a pattern in the forward direction?
(A) => /
(B) => ?
(C) => //
Answer =>> /

[68] Which of the following commands is used to assign executable permission to the owner of the file named "note"?
(A) => chmod g+x note
(B) => chmod u+w note
(C) => chmod u+x note
Answer =>> chmod u+x note

[69] The command to count the number of files in the current directory by using pipes, is
(A) => ls | wc
(B) => ls -l | wc -l
(C) => ls | wc -w
Answer =>> ls | wc -w

[70] Which of the following commands is used to get directory one level up?
(A) => cd
(B) => cd ..
(C) => cd/
Answer =>> cd ..

[71] Which of the following commands is used to count the total number of lines, words, and characters contained in a file.
(A) => count p
(B) => wc
(C) => wcount
Answer =>> wc

[72] Which command is used to delete all files in the current directory as well as all files and sub-directories in its subdirectories?
(A) => rm *
(B) => rm -r *
(C) => rm all
Answer =>> rm -r *

[73] Which of the following commands is used to change the working directory?
(A) => cd
(B) => changedir
(C) => chdir
Answer =>> cd

[74] Which of the following commands is used to view your file 24 lines at a time?
(A) => pg
(B) => cat
(C) => lp
Answer =>> pg

[75] Which shell's wild-cards is used to match a single character?
(A) => *
(B) => ?
(C) => [ijk]
Answer =>> ?

[76] In Bourne shell, which file sets the Unix environment for the user when the logs into his HOME directory.
(A) => .exrc
(B) => .profile
(C) => lastlogin
Answer =>> .profile

[77] Which command is used to copy the three files wb, collect and mon into the misc directory, under the same, when you were currently in the programs directory?
(A) => copy wb ../misc collect ../misc mon ../misc
(B) => cp wb collect mon ../misc
(C) => copy wb collect mon /misc
Answer =>> cp wb collect mon ../misc

[78] The command chmod 761 note is equivalent to
(A) => chmod 167 note
(B) => chmod u=rwx, g=rw, o=x note
(C) => chmo a =761 note
Answer =>> chmod u=rwx, g=rw, o=x note

[79] The commonly used UNIX commands like date, ls, cat, etc. are stored in
(A) => /dev directory
(B) => /bin and /usr/bin directories
(C) => /tmp directory
Answer =>> /bin and /usr/bin directories

[80] Which of the following commands is used to remove files with confirmation prompt from the user file system which have neither been accessed nor modified i the last one year?
(A) => find /user/* \(-mtime + 365 - a - atime +365 \) - OK rm {} \;
(B) => find -name - mtime + 365 / - ok rm
(C) => None of the above
Answer =>> find /user/* \(-mtime + 365 - a - atime +365 \) - OK rm {} \;

[81] Which of the following commands is used to summarize the disk usage?
(A) => chkdsk
(B) => fdisk
(C) => du
Answer =>> du

[82] Which command is used to sort the lines of data in a file in alphabetical order?
(A) => sort
(B) => sh
(C) => st
Answer =>> sort

[83] If a file has read and write permissions for the owner, then the octal representation of the permissions will be
(A) => 1
(B) => 6
(C) => 3
Answer =>> 6

[84] Which command is used to copy a file wb with the same name from the programs directory to the misc directory?
(A) => copy programs/wb misc/wb
(B) => cp programs/wb misc
(C) => tar programs/wb misc/wb
Answer =>> cp programs/wb misc

[85] Which is the earliest and most widely used shell that came with the UNIX system?
(A) => C shell
(B) => Korn shell
(C) => Bourne shell
Answer =>> Bourne shell

[86] The seventh field of /etc/password is
(A) => password
(B) => login
(C) => shell
Answer =>> shell

[87] Which command is used to display the end of the file?
(A) => head - r
(B) => tail
(C) => eof
Answer =>> tail

[88] Which command is used to create a directory?
(A) => crdir
(B) => md
(C) => mkdir
Answer =>> mkdir

[89] Which command is used to display the device name of the terminal you are using?
(A) => tty
(B) => ls
(C) => who
Answer =>> tty

[90] The ls -l command tells
(A) => who the owner of the file is
(B) => the name of the group owner of the file
(C) => All of the above
Answer =>> All of the above

[91] Which option will be used with disk free command to include the total amount of disk space in the file system?
(A) => -t
(B) => -tt
(C) => -4
Answer =>> -t

[92] Which command is used to set the three permissions for all the three categories of users of a file?
(A) => chgrp
(B) => chown
(C) => chmod
Answer =>> chmod

[93] Which of the following commands can be used to get information about yourself?
(A) => who am i
(B) => i /4
(C) => pwd
Answer =>> who am i

[94] Which of the following commands can be used to get information about all users who are currently logged into the system?
(A) => which
(B) => who
(C) => who am i
Answer =>> who

[95] Which of the following keys is used to overstrike a whole line?
(A) => R
(B) => v
(C) => A
Answer =>> R

[96] Which command is used to locate all the .profile files in the system?
(A) => ls profile
(B) => find /-name profile -print
(C) => cd /.profile
Answer =>> find /-name profile -print

[97] The File that contains a set of instructions which are performed when a user logs in, is
(A) => .exrc
(B) => .profile
(C) => .autoexec
Answer =>> .profile

[98] The octal representation 652 indicates
(A) => Execute permission for the owner
(B) => Write permission for others
(C) => Read and write permission of groups
Answer =>> Write permission for others

[99] Which of the following command is used to count just the number of lines contained in a file?
(A) => wc -l
(B) => wc -c
(C) => wc -w
Answer =>> wc -l

[100] Which of the following command is used to go to home directory?
(A) => cd..
(B) => cd/
(C) => cd
Answer =>> cd

[101] Which command is used to move all files to the bin sub-directory of the parent directory?
(A) => mv *.* /bin/
(B) => mv * /bin/*
(C) => mv * ../bin
Answer =>> mv * ../bin

[102] Which command is used to save the standard output in a file, as well as display it on the terminal?
(A) => tee
(B) => grep
(C) => cat
Answer =>> tee

[103] The command that can be used to restrict incoming messages to a user is
(A) => mesg
(B) => grep
(C) => halt
Answer =>> mesg

[104] Which of the following commands is used to copy directory structures in and out
(A) => cp
(B) => cpio
(C) => cp - p
Answer =>> cpio

[105] Which of following commands is used for an automatic reminder service?
(A) => write
(B) => mesg
(C) => calendar
Answer =>> calendar

[106] Which command allows you to view your file 24 lines at a time?
(A) => more
(B) => pg
(C) => cat
Answer =>> pg

[107] Which of the following special shell variables is used to process number of the current shell?
(A) => $!
(B) => $$
(C) => $0
Answer =>> $$

[108] Which option is used with cmp command to give a detailed list of the byte number and the differing bytes in octal for each character that differs in both the files?
(A) => -l
(B) => -d
(C) => -b
Answer =>> -l

[109] Which command is used with vi editor scroll half page backward?
(A) => [Control-d]
(B) => [Control - u]
(C) => [Control-c]
Answer =>> [Control - u]

[110] Which command is used with vi editor to move cursor forward to first occurrence of character 'ch' in the current line?
(A) => tch
(B) => fch
(C) => rch
Answer =>> fch

[111] Which of the following keys is used to delete the character beneath the cursor?
(A) => x
(B) => X
(C) => dd
Answer =>> x

[112] Which command is used to assign only read permission to all three categories of the file 'note'?
(A) => chmod go+r note
(B) => chmod a-rw
(C) => chmod ugo=r note
Answer =>> chmod ugo=r note

[113] Which command will be used with vi editor to append text at end of line?
(A) => A
(B) => a
(C) => i
Answer =>> A

[114] The first set of the three permissions (rw) pertains to the owner of the file, indicating that the owner has
(A) => executable permission only
(B) => both read and write permissions
(C) => both read and executable permissions.
Answer =>> both read and write permissions

[115] Which of the following commands is used to save the output of the who command in a file named user.lst, as well as display it?
(A) => who | tee user.lst
(B) => who > user.lst
(C) => who >> user.lst
Answer =>> who | tee user.lst

[116] Which of the following shell's wildcards are used to match any number of characters including none?
(A) => [!ijk]
(B) => ?
(C) => *
Answer =>> *

[117] The command used to remove the directory is;
(A) => rmdir
(B) => rd
(C) => remove
Answer =>> rmdir

[118] Which symbol will be used with grep command to match the pattern pat at the end of a line?
(A) => ^pat
(B) => $pat
(C) => pat$
Answer =>> pat$

[119] Which command is used to display all the lines with the string 'sales' from the file empl.lst?
(A) => cut sales empl.lst
(B) => /sales > empl.lst
(C) => grep sales empl.lst
Answer =>> grep sales empl.lst

[120] Which of the following commands is not the vi Input mode command?
(A) => rch
(B) => R
(C) => j
Answer =>> j

[121] Which of the following commands is used to remove files?
(A) => erase
(B) => delete
(C) => rm
Answer =>> rm

[122] Which command is used with vi editor to save file and remain in the editing mode?
(A) => :q
(B) => :w
(C) => q!
Answer =>> :w

[123] You can append to a file instead of overwriting by using the
(A) => > symbols
(B) => >> symbols
(C) => < symbols
Answer =>> >> symbols

[124] The [line number G] key allows you
(A) => to move cursor left by one position
(B) => to move cursor down by one line
(C) => to move cursor to the beginning of the line specified by the number
Answer =>> to move cursor to the beginning of the line specified by the number

[125] Which of the following commands is used to have a two-way communication with any person who is currently logged in?
(A) => mail
(B) => mesg
(C) => write
Answer =>> write

[126] Which command is used with vi editor to move the cursor to the left?
(A) => j
(B) => k
(C) => h
Answer =>> h

[127] Which of command is used to copy a file?
(A) => copy
(B) => cp
(C) => cpio
Answer =>> cp

[128] The special shell variable $* is used
(A) => to exit status of ast command executed.
(B) => to process number of the current shell
(C) => to list the positional parameters
Answer =>> to list the positional parameters

[129] The cat command is used to
(A) => capture a file
(B) => display a file
(C) => print a file
Answer =>> display a file

[130] The UNIX file system stores a date in physical blocks of
(A) => 1024 bytes
(B) => 2048 bytes
(C) => 512 bytes
Answer =>> 512 bytes

[131] Which command is used to terminate all processes in your own system except the login shell?
(A) => kill 1
(B) => kill 0
(C) => cancel all
Answer =>> kill 0

[132] Which operator will be used with chmod command to assign absolute permission?
(A) => +
(B) => -
(C) => =
Answer =>> =

[133] Which command is used to link the files?
(A) => Ik
(B) => In
(C) => cp
Answer =>> In

[134] Which of the following signs is used to back up over typing errors in vi?
(A) => @
(B) => #
(C) => $
Answer =>> #

[135] Major expressions used with find command to select file is it has been accessed in more than 375 days, is
(A) => -a time +365
(B) => -mtime + 365
(C) => -a time -365
Answer =>> -a time +365

[136] Which of are following internal commands is used in mail to forward mail to user in user-list?
(A) => r user-list
(B) => m user-list
(C) => d user-list
Answer =>> m user-list

[137] Which of the following commands is used to display the filenames in multiple columns?
(A) => ls
(B) => ls -1
(C) => ls -x
Answer =>> ls -x

[138] Which command is used with file named 'note' to remove the executable permission from the user and assign read permission to the group and others?
(A) => chmod u-x, go+r note
(B) => chmod go+r, u+x note
(C) => chmod g-x, uo+r note
Answer =>> chmod u-x, go+r note