Which of the following commands will you use?

You want to repeat the last command you entered in the bash shell. Which of the following
commands will you use?

You want to repeat the last command you entered in the bash shell. Which of the following
commands will you use?

A.
history !#

B.
history !!

C.
history ##

D.
history !1

Explanation:

The history !! command shows the previously entered command in the bash shell. In the bash
shell, the history command is used to view the recently executed commands. History is on by
default. A user can turn off history using the command set +o history and turn it on using set –o
history. An environment variable HISTSIZE is used to inform bash about how many history lines
should be kept. The following commands are frequently used to view and manipulate history:

Answer option A is incorrect. The history !# command shows the entire command line typed.
Answer option D is incorrect. The history !n command shows the nth command typed. Since n is
equal to 1 in this command, the first command will be shown.
Answer option C is incorrect. It is not a valid command.



Leave a Reply 0

Your email address will not be published. Required fields are marked *