Home »
Aptitude Questions and Answers »
Linux Aptitude Questions and Answers
Linux Shell Commands Aptitude Questions and Answers
Linux Shell Commands Aptitude Questions and Answers: This section contains aptitude questions and answers on Linux Shell Commands.
Submitted by Nidhi, on May 20, 2020
This section contains Aptitude Questions and Answers on Linux Shell Commands.
1) Which of the following command is used to check a Linux command is a built-in shell command or external command?
- cmdtype
- type
- ctype
- commandtype
Correct answer: 2
type
The type command is used to check a Linux command is a built-in shell command or external command.
2) Which of the following commands are built-in shell commands in the Linux operating system?
- pwd
- cd
- export
- echo
Options:
- A and B
- C and D
- A, B, and C
- A, B, C, and D
Correct answer: 4
A, B, C, and D
All given commands are built-in shell commands.
3) Which of the following commands are external commands in the Linux operating system?
- cat
- file
- help
- man
Options:
- A and B
- C and D
- A, B, and D
- A, B, C, and D
Correct answer: 3
A, B, and D
The cat, file, and man are external commands used in the Linux operating system.
4) Which of the following command is used to display the path of a command in the Linux File System?
- pcmd
- which
- pathcmd
- None of the above
Correct answer: 2
which
The which command is used to display the path of a command in the Linux File System.
5) Which of the following command is used to assign a new name to the Linux built commands?
- newcmd
- new
- alias
- aliasname
Correct answer: 3
alias
The alias command is used to assign a new name to the Linux built commands?
6) Which of the following command is used to enable the shell expansion?
- shell +x
- shell -x
- set -x
- set +
Correct answer: 3
set -x
The set –x command is used to enable the shell expansion.
7) Which of the following operator is used to execute multiple commands in a single line?
- ;
- %
- &&
- ||
Correct answer: 1
;
The semicolon (;) operator is used to executing multiple commands in a single line.
8) Which of the following command is used to remove an existing alias?
- rmalias
- unalias
- delalias
- ralials
Correct answer: 2
unalias
The unalias command is used to remove an existing alias.
9) Which of the following operator is used to comment lines in a shell script file?
- //
- \\
- /**/
- #
Correct answer: 4
#
The # operator is used to comment line in a shell script file.
10) The alias created by "alias" command can be used after exiting from shell?
- Yes
- No
Correct answer: 2
No
No, the alias created by the alias command can be used after exiting from shell. We can create permanent alias by storing alias in the bash startup file.
11) Which of the following operator is used to store the exit code of a previous command?
- $?
- %$
- ?&
- ?@
Correct answer: 1
$?
The dollar question mark ($?) is used to store the exit code of a previous command.
12) There are the following statements that are given below, which of them are correct about Globbing?
- The Globbing is used to recognize the wildcard characters and then expand them into path-name.
- The Globbing is also known as path-name expansion.
- The File Globbing is not supported by the Linux operating system.
- All the above
Options:
- A and B
- A and C
- A, B, and C
- D
Correct answer: 1
A and B
Statements A and B are correct about GLobbing in the Linux operating system.
13) There are the following statements that are given below, which of them are correct about Wildcards in the Linux operating system?
- Wildcards are the string patterns that contain some special characters.
- Wildcards are used to perform actions on one or more file that uses the same pattern.
- Linux shell used wildcard characters for globbing.
- All the above
Options:
- A and B
- A and C
- A, B, and C
- D
Correct answer: 4
D
All given statements are correct about Wildcards in the Linux operating system.
14) Which of the following characters are used for wildcards in the Linux operating system?
- ?
- *
- []
- <>
Options:
- A and B
- A and C
- A, B, and C
- D
Correct answer: 3
A, B, and C
In the Linux, Question mark ?, asterisk *, and square brackets [] are used as wildcard characters.
15) Which of the following command is used to display the last executed commands list?
- lastcmd
- last
- history
- chistory
Correct answer: 3
history
The history command is used to display the last executed commands list.
16) Which of the following environment variable is used to specify the number of commands history in the current environment?
- $HISTSIZE
- $HISSIZE
- $HISTORYSIZE
- $HSIZE
Correct answer: 1
$HISTSIZE
The $HISTSIZE environment variable is used to specify the number of commands history in the current environment. It can also modify according to our requirements.
17) Which of the following command is known as "bang bang" in the Linux operating system?
- ##
- $$
- !!
- @@
Correct answer: 3
!!
The double exclamation (!!) is known as "bang bang" in the Linux operating system.
18) There are the following statements that are given below, which of them are correct about "bang bang" command in the Linux operating system?
- The "bang bang" command is used to remove commands history.
- The "bang bang" command is used to remove execute last executed command.
- The "bang bang" command is used to display the last login time of the current user.
- None of the above
Correct answer: 2
The "bang bang" command is used to remove execute last executed command.
The "bang bang" command is used to remove execute last executed command.
19) Which command is used to execute a command based on the number assigned in the command history, here we denote command history number by N?
- !N
- #N
- $N
- !!N
Correct answer: 1
!N
The single exclamation is used with history numbers to execute the specific command from history.
20) Can we embed the new shell on the command line?
- Yes
- No
Correct answer: 1
Yes
Yes, we can embed the new shell on the command line.