Linux command history

[root@linux ~]# history [n]
[root@linux ~]# history [-c]
[root@linux ~]# history [-raw] histfiles


-n  :number, meaning ' the n command to list the most recent list ' means!

-c  :All the history in the current shell delete all content

-a  :Will be added into the history currently added instruction in histfiles, if not histfiles, then the default write ~/.bash_history

-r  :To read the contents of histfiles to the current shell history of memory;

-w  :Current history memory contents will be written in the histfiles!

[root@linux ~]# !number
[root@linux ~]# !command
[root@linux ~]# !!


 number :The number command execution;

command :Instruction by the recent search forward 'command at the beginning of the string for the command' of the instruction, and execution;

    !!    :excute the last command (corresponding to the ↑ key, press Enter);


[root@linux ~]# history
66  manrm
67 alias
68  manhistory
69 history
[root@linux ~]# !66  <==excute the 66 command
[root@linux ~]# !!  <==excute the last command,In this case, that !66
[root@linux ~]# !al <==Executive recently as the beginning of the 'al' (listed in the top 67)

Pingbacks are closed.