How to use the history command in Linux
Created
The history command works with the command history list. When the command is issued with no options, it prints the history list.
The History library provides a history expansion feature that is similar to the history expansion provided by `csh'. This section describes the syntax used to manipulate the history information.
History
history
Help
grep --help
info history
man history
826 ll 827 mkdir software
To see a certain number of commands, you can pass a number to history on the command line.
10 commands
history 10
history | tail -n 10
Repeating Commands
!897
the last command
!!
the last command that started with cd
!cd
!cd:p
!?aliases
history | grep aliases
Deleting Commands
history -d 83
history -d 22 32
history -d -5
897 history 10
The syntax for the history command is as follows:
Usage:
history [-c] [-d offset] [n]
history -awrn [filename]
history -ps arg [arg...]
OPTIONS:
-dRemove history entry at offset which from the history.-cClearing the History List