Linux Commands-History: Displaying or manipulating historical lists

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.