What does the history
command do in UNIX?
a) Displays the list of previously executed commands
b) Displays system log files
c) Shows the list of active users
d) Displays recently modified files
Answer:
a) Displays the list of previously executed commands
Explanation:
The history
command in UNIX displays a list of previously executed commands. This allows users to quickly review their command history and re-execute commands without needing to retype them. Each command is associated with a unique number in the history list.
For example, typing !123
will re-execute the command with the history number 123. You can also search through the history by pressing the Ctrl
+ r
keys, which initiates a reverse search for commands based on what you type.
Using the history
command is a time-saving feature in UNIX. It simplifies repetitive tasks by allowing users to quickly re-run or modify previous commands, improving productivity in the terminal environment.