Management and usage history command summary

1. Command Line History:
Enter the command on the command line, shell history will record every executed in memory, when the user exits, shell command history will record appended to the current user's ~ / .bash_history file. When a user logs on again, shell reads the user's home directory .bash_history file
2.history command:
History [-c] [-d offset] [the n-]
History -anrw [filename]
History -ps Arg [Arg .. .]
-c: empty command history
-d offset: delete history specifies that the first offset command
n: displays the most recent history of n
-a: append this session newly executed command history list to the history file
-r: read history attach a file to the history list
-w: save history list to the specified history file
-n: unread to read the history file line to the history list
-p: expand the historical parameters into multiple lines, but the history list does not exist
-s: expand historical parameter in a row, appended to the history list
3. the use of command history:
using up and down keys to browse command that was once performed, press enter performed
ctrl-r search command in the command history
(reverse-i-search) ` ' :
Ctrl + G: exit from the history search mode
to recall the previous command in the last parameter
! $ express
Esc, (click the Esc key to loosen, then click on the button.).
Alt + (Hold down the Alt key while clicking key.).
Repeat the command
① Press Enter key and
② and enter a carriage return !!
③ input-1 and enter!
④ P and the Ctrl + Enter
:! 0 Run previous command (removal parameter)
the Ctrl + n shows the current history of the next command, but does not perform
Ctrl + j execution of the current command
! n execution history command output command corresponding to the number n
! -n execution history reciprocal of the n-th history command
! command before the string to repeat a "string" at the beginning of the
previous command to repeat a string that contains the string!?
string:! print only the p-command history without executing the
$:! p printout $ (on a command last! parameters) of content
! :! the p-printout of all parameters (on a command) contents
^ string removes the first on a command String
^ ^ string1 string2 will be replaced on a command for the first string1 string2
4 call history parameters:
! the command ^ the first argument on the use of a command to do cmd parameter
command $ last argument on the use of a command to do cmd argument!
the command! all parameters on the use of a command to do cmd parameter
c ommand:! n n-th parameters do use a command parameter cmd
! command n: ^ The first argument invoked Article n command
command n:! The last parameter $ invoked Article n command
command n:! m m-th argument invoked Article n command
command n:!
call the first All parameters n command call history parameter
command string:! ^ search history from command to command starting with string and get its first parameter
command string:! $ Search to the beginning of the string of commands from the command history, and get its last parameter
command string:! n search begins with string commands from the command history, and obtain its n th parameter
command string:! search begins with string commands from the command history, and get all of its parameters
the command history relating environment variables:
the HISTSIZE: Article number command history
HISTFILE: history file specified, the default is ~ / .bashhistory
the HISTFILESIZE: command history file number of records of history
HISTTIMEFORMAT = "% F% T" display time
HISTIGNORE = "str1: str2: ..." ignore command str1, str2 beginning of the history
control recording command history: the
environment variable: HISTCONTROL
ignoredups default, ignored repeated Command, continuous and identical to "repeat"
ignorespace ignore all commands that start with a blank
ignoreboth equivalent ignoredups, ignorespace combination
erasedups delete duplicate commands
export variable name = "value"
is stored in / etc / profile or ~ / .bash_profile

Guess you like

Origin blog.51cto.com/14483057/2428373