Linux common Commands (a)--history command

Source: Internet
Author: User

The history record has entered commands without any parameters and displays the default number of command histories directly.


(1) View and modify history settings.

in the user's home directory, such as the/root directory, exists. Bash_profile and . Bash_profile these two files.

which . Bash_history is the history of the command that records the number of directory entries.

The. Bash_profile is the set history property.

Such as:

1, modify the number of Histroy saved.

Method One:

# User specific environment and startup programs


Path= $PATH: $HOME/bin


Export PATH

histsize=300

histfilesize=300


added at the end of the document histsize and Histfilesize two values. Setup is complete and restarting the terminal will take effect.


Method two, export histsize=10



2, modify the history of the display format

Export histtimeformat= '%F%T '



(2) How to use

History N: Shows the historical record of the nearest n bar

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/66/wKioL1X8PVjB645EAAC1TPdso9c126.jpg "title=" History01.jpg "alt=" Wkiol1x8pvjb645eaac1tpdso9c126.jpg "/>

Figure 1.1


history-d Offset: Delete the command entry at the specified offset

Delete History at 317, 1.2

History-d 317 After the deletion succeeds, the command at the original 317 is replaced with the command at 318, as shown in 1.3.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/68/wKiom1X8OwuBhPvPAACczhsQCV4356.jpg "title=" History02.jpg "alt=" Wkiom1x8owubhpvpaacczhsqcv4356.jpg "/>

Figure 1.2


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/68/wKiom1X8O0TA7dyUAACgjZvrzc8368.jpg "title=" History03.jpg "alt=" Wkiom1x8o0ta7dyuaacgjzvrzc8368.jpg "/>

Figure 1.3


history-a [path]: Writes the history of a command in the current session to the specified file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/66/wKioL1X8PeKhoZkGAAEDQ4MqKxQ036.jpg "title=" History04.jpg "alt=" Wkiol1x8pekhozkgaaedq4mqkxq036.jpg "/>

Figure 1.4


History-c: Emptying command history

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/66/wKioL1X8Pibh5AKrAABSiSNwMAE664.jpg "title=" History05.jpg "alt=" Wkiol1x8pibh5akraabsisnwmae664.jpg "/>

Figure 1.5


(3) Tips for use

!#: Execute the # command in the history of the command

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/66/wKioL1X8PvqAIzu1AABwbz5rpn8065.jpg "title=" History06.jpg "alt=" Wkiol1x8pvqaizu1aabwbz5rpn8065.jpg "/>

Figure 1.6


!: Executes the previous command

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/68/wKiom1X8PX_jaZ09AADnWKPyomA060.jpg "title=" History07.jpg "alt=" Wkiom1x8px_jaz09aadnwkpyoma060.jpg "/>

Figure 1.7


!string: Executes the last command in the command history that begins with string;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/68/wKiom1X8PnezsBKkAACJWbCTqfg779.jpg "title=" History08.jpg "alt=" Wkiom1x8pnezsbkkaacjwbctqfg779.jpg "/>

Figure 1.8


!$: Call the last parameter of the previous command

ESC,.: function Ibid.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/68/wKiom1X8PuCRIbiXAACMTl0iZmE594.jpg "title=" History09.jpg "alt=" Wkiom1x8pucribixaacmtl0izme594.jpg "/>

Figure 1.9


Second, help command

(1) View command type

Type COMMAND

such as: type history

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/66/wKioL1X8QUWA0nfFAABF3MDA8aM660.jpg "title=" History10.jpg "alt=" Wkiol1x8quwa0nffaabf3mda8am660.jpg "/>

Figure 1.10


(2) Help commands for built-in commands

Help COMMAND

Like Help

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/68/wKiom1X8P1byl4toAAH3u5hxkL0877.jpg "title=" History11.jpg "alt=" Wkiom1x8p1byl4toaah3u5hxkl0877.jpg "/>

Figure 1.11


(3) Help commands for external commands

1. COMMAND--help

such as LS--help

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/73/66/wKioL1X8Qb3S8HUaAAKh3bY0ShY822.jpg "title=" History12.jpg "alt=" Wkiol1x8qb3s8huaaakh3by0shy822.jpg "/>

Figure 1.12



This article is from the "elf-Goblin, brain" blog, please be sure to keep this source http://xuewen.blog.51cto.com/1203741/1696197

Linux common Commands (a)--history command

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.