- Published on
fc command-edit and execute historical commands
Jonas
1 min read
The EXTENDED_HISTORY environment variable affects the execution of the fc command. If the variable is set to ON, the time is recorded, otherwise the time is not recorded.
Syntax: fc [parameter]
Command parameters:
-e<text editor> | Specify the text editor used to edit the command, the default is vi |
-l | List the history commands within the command range of the first and last day. If the command range is not followed, the 16 most recently used history commands will be displayed by default |
-n | Do not display command serial number when displaying historical commands |
-r | Display all historical commands in reverse order |
-s<command name> | Find the specified command from the current position in the history command and execute it |
Example
Display the history command list (the last 16 history commands are printed by default):[root@linuxstar ~]# fc -lSpecify editing commands using the ex text editor:
[root@linuxstar ~]# fc -e exDisplay the history command list but not the command sequence number:
[root@linuxstar ~]# fc -nDisplay all historical commands in reverse order:
[root@linuxstar ~]# fc -rFind the find command from the historical commands and execute:
[root@linuxstar ~]# fc -s find