Page History
...
For instance to view all the previously executed commands, type history
at the FluidShell prompt;
Code Block |
---|
:$ history 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history |
...
The shell variables which provide control options to this command can be viewed as follows:
Code Block |
---|
:$ export | grep HIST declare -x CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY="true" declare -x HISTCONTROL="ignoredups:ignorespace" declare -x HISTFILE="C:\\Users\\vikram\\.datastudio\\connections\\MSSQL Server 2012 on Ferenganar.history" declare -x HISTFILESIZE="500" declare -x HISTSIZE="500" |
...
CLI_SHELL_LINE_INTERPRETER_EVAL_HISTORY
...
HISTCONTROL variable allows you to control how FluidShell stores your command history. You can tell it to ignore duplicate commands and/or to ignore commands that have leading whitespaces. This is especially useful since we tend to use some commands multiple number of times. These duplicate commands can fill up the command history pretty fast, crowding the ones we really might need. We can use the "ignoredups" (default) to ignore duplicate commands.
For example:
Code Block |
---|
:$ history 1 history 2 export | grep HIST |
...
Code Block |
---|
:$ pwd C:/Users/vikram |
...
Code Block |
---|
:$ pwd C:/Users/vikram |
...
Code Block |
---|
:$ pwd C:/Users/vikram |
...
Code Block |
---|
:$ history 1 history 2 export | grep HIST 3 pwd << This command had duplicates and has come only once. 4 history |
...
Info |
---|
Note: "ignoredups" will only ignore immediately executed duplicate commands. |
...
- You can view all the previously executed commands using the
history
command.
Code Block |
---|
:$ history 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history |
...
You can also filter command history using pipeling and grep such as:
Code Block |
---|
:$ history | grep "export" 2 export grep HIST 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"erasedups " 5 export | grep HIST 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 22 history | grep "export" |
...
Code Block |
---|
:$ history | more 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL . . . (paginated ...) . . . 111 pwd 112 history 113 ls 114 sendmail 115 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 116 clear 117 history | more |
...
|
2. You can also execute a previous command using the following options:
a) !!
to execute the last command in command history.
For instance:
Code Block |
---|
:$ pwd C:/Users/vikram |
...
Code Block |
---|
:$ !! pwd C:/Users/vikram |
...
b) !<number>
where <number> is the index of a command in the command history. For instance to repeat "\help" command:
Code Block |
---|
:$ !6 \help alias ask autocommit cat cd change clear cli commit compare connect cp csv2excel csv2html csv2json csv2xml declare describe disconnect echo erm exec export fluidshell go grep gunzip gzip help history list ls mkdir more mv open pwd reconnect ren rm rmdir rollback run scp sendmail session sleep source sqlbuffer sqldump sqlexport sqlhistory sqlimport ssh syncdir tail tar tee touch unalias unset unzip zip |
Please note using a negative number is permissible and is taken as the index from the last command entry. For instance executing:
Code Block |
---|
:$ history 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history |
...
Code Block |
---|
:$ !-4 Sendmail Usage: sendmail [OPTION...] ADDRESS... Try "\help sendmail" for more information. |
...
c) !<string>
where <string> is the initial sequence of this command. Such as:
Code Block |
---|
:$ !se Sendmail Usage: sendmail [OPTION...] ADDRESS... Try "\help sendmail" for more information. |
...
Please note that this will execute the most recent command starting with this sequence.
d) !?
executes the most recent command containing the string . Such as:
Code Block |
---|
:$ !?more history | more 1 history 2 \help 3 export | grep HIST 4 export HISTCONTROL=$HISTCONTROL:"ignorespace " 5 export | grep HIST 6 \help 7 history | more 8 clear 9 sqlhistory 10 echo $HISTCONTROL 11 pwd 12 history 13 ls 14 sendmail 15 export HISTFILE=C:\\Users\\vikram\\.datastudio\\connections\\vikram.history 16 clear 17 history | more |
...
3. Using history –c
command clears all the existing history (new history will still get created) in the current FluidShell. Please note that since the in-memory command history will be deleted by this command, those deleted commands as such will also not appear in the FluidShell history file (database server connection.history) for the current database server connection.
...