Linux / Unix questions and answers focuses on Bash Shell environment. It will be useful for anyone learning Linux Basics, Essentials and Shell programming.
1. To feed standard output of one command to standard input of another in a single shell session
a) IO redirection can be used
b) Named pipes can be used
c) The pipe operator provided by the shell can be used
d) It can not be done
Answer: c
Clarification: None.
2. Which of the following commands allows definition and assignment of environment variables under bash
a) env
b) export
c) environ
d) setenviron
Answer: a
Clarification: None.
3. While executing a command, the shell
a) Executes it in the same process (as shell)
b) Creates a child shell to execute it
c) Loads a special program to take care of the execution
d) None of the mentioned
Answer: b
Clarification: None.
4. Which variable contains current shell process id
a) $*
b) $?
c) $$
d) $!
Answer: c
Clarification: None.
5. Which command is used to debug a shell script program
a) set
b) set -x
c) debug
d) db
Answer: b
Clarification: None.
6. For every successful login, which script will be executed?
a) /etc/inittab
b) /etc/profile
c) /etc/login
d) /etc/init
Answer: b
Clarification: None.
7. Hidden files are
a) Those whose ‘read’ bit is set to ‘h’
b) Permitted for (can be accessed) only superusers
c) Files that begin with a ‘.’
d) Files that cannot be opened by ordinary user for writing
Answer: c
Clarification: None.
8. Shell is ?
a) Command Interpreter
b) Interface between Kernel and Hardware
c) Interface between user and applications
d) Command Compiler
Answer: a
Clarification: None.