History

From Unix SME

Command name:

 history

Description:

 To view, edit, or delete the shell history.
 view last n lines of history
 clear history
 delete a single history entry
 append new history line to a file
 append history lines not already in history file to another file
 append the current history to the history file

'Syntax:

 history 
 history [n]
 history -c
 history -d offset
 history [-anrw] [filename]
 history -ps arg
 history ![n]

Options

'Examples:

 1. history # show full history
 2. history 3 # show last 3 commands
 3. history -c # clear the history list, but not the history file
 4. history -d 3 # delete command 3
 5. history -a session_history.txt # append the current Bash history to session_history.txt
 6. !50 # executes the command that is on line 50
 7. !! # views and reruns the most recent command