Top 150+ Solved Linux Programming MCQ Questions Answer
Q. Which of these commands will set the permissions on file textfile to read and write for the owner, read for the group, and nothing for everyone else?
a. chmod 046 textfile
b. chmod 640 textfile
c. chmod 310 textfile
d. chmod rw r nil textfile
Q. If you are a root user, how can you grand execute permission only for the owner of the fileproject1?
a. chmod +x project1
b. chmod u+x project1
c. chmod a+x project1
d. chmod U+X project1
Q. A user executes the following command successfully:$ chmod +x file1.txt Which of the following is true of the output of this command?
a. The command results in adding execute permission to the user who ran this command
b. The command results in adding execute permission for the owner of the file
c. The command results in an error since the file is not an executable file
d. The command results in adding execute permission for all users (i.e., user,group & others)
Q. What does chmod +t do?
a. wrong syntax
b. set effective userid for filename
c. set effective groupid for filename
d. set the sticky bit
Q. Which of the following umask settings doesn’t allow execute permission to be set by defaulton directory files
a. 222
b. 111
c. 000
d. 444
Q. Which of the following umask settings allow execute permission to be set by default on regular files
a. 222
b. 111
c. 000
d. None of the given choices
Q. The command chmod 4777 a.out
a. will set the suid bit of out
b. will set the suid bit of a.out only if the command is issued by root
c. is not a valid command
d. will set the sticky bit of a.out
Q. The commonly used UNIX commands like date, Is, cat, etc. are stored in
a. /dev directory
b. /bin and /usr/bin directories
c. /unixdirecotry
d. /tmp directory
Q. Which command is used to concatenate all files beginning with the string ‘emp’ andfollowed by non-numeric characters?
a. catemp{!0-9]
b. more [emp][!0-9]
c. cateemp[x-z]
d. catemp[a-z]
Q. Which command will be used to match the pattern agarwal, Aggarwal, Agggarwal and agrawal in the file named empl.1st?
a. grep “[aA]99*[ar][ra]wal” empl.1st
b. grepag* empl.1st
c. cutagrawal empl.1st
d. grepag[ra][ar]wal empl.1st
Q. Which command is used to select those lines where the data lies between 7000 and 7999at the end of the line of file empl.lit.
a. grep “$7…” empl.1st
b. grep “7…^” empl.1st
c. grep “7…$” empl.1st
d. grep ^7… empl.1st
Q. Which command is used to select those lines that begin with a 2 in the tre file empl.1st?
a. grep “^2” empl.1st
b. grep “2…” empl.1st
c. grep “7^” empl.1st
d. grep “2^” empl.1st
Q. Which of the following commands is used to update access and modification times of a file?
a. grep
b. wc
c. touch
d. cat
Q. The command that can be used to restrict incoming messages to a user is
a. mesg
b. halt
c. grep
d. sleep