Command format
History [-c] [-D offset] [n]
HISTORY-ANRW [filename]
History-ps arg [arg...]
Command parameters
-C
Clears the History list.
-D Offset
Delete the history entry numbered as offset.
N
Displays the most recent N records.
History extension
Sequence |
Behavior |
!! |
Repeats the last command executed. Pressing the UP ARROW key and pressing the Enter key also enables the same functionality and is more consistent with the operating habits. |
!number |
Repeats the command in the number line in the history. |
!string |
Repeats the most recent command that starts with a string. |
!? String |
Repeats the most recent command that contains a string. |
Instance
A) Displays the 5 most recently executed commands.
History 5 848 pwd 849 Curl ifconfig.sh 850 last 851 clear 852 history 5
b) Delete The history entry numbered 850.
History-d 850
c) Clear the History list.
History-c
D) Execute the previous command that starts with curl.
!curlCurl ifconfig.sh104.238.141.75
Linux Commands-History: Displaying or manipulating historical lists