BreadCrumbs: History Command

History Command

From Luke Jackson

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:09, 18 November 2020 (edit)
Ljackson (Talk | contribs)
(List All Entries without line numbers)
← Previous diff
Current revision (05:13, 18 November 2020) (edit)
Ljackson (Talk | contribs)
(Examples)
 
Line 17: Line 17:
=== List All Entries without line numbers === === List All Entries without line numbers ===
history -w /dev/stdout history -w /dev/stdout
 +
 +=== Extract all history commands at end-of-session (EOS) ===
 + history -w /dev/stdout > history_EOS_`date +%a_%b_%d_%F_%T`.txt
=== List All Entries === === List All Entries ===
Line 29: Line 32:
history -d <offset> history -d <offset>
 +
 +=== Delete last N lines from bash history ===
 + for i in {1..50}; do history -d 1030; done
[[Category:Mac OS X]] [[Category:Mac OS X]]
[[Category:Linux]] [[Category:Linux]]

Current revision

history -- Linux/Unix/Mac OS X find command

Contents

Introduction

You can use history to view a list of the commands executed during the current $SHEL session. It is very helpful when are you are typing a lot of complex commands.

Syntax

lazy....

Usage

usage: history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...]

Examples

List All Entries without line numbers

history -w /dev/stdout

Extract all history commands at end-of-session (EOS)

history -w /dev/stdout > history_EOS_`date +%a_%b_%d_%F_%T`.txt

List All Entries

history

Execute Entry

!<offset>

Delete Entry

history -d <offset>

Delete last N lines from bash history

for i in {1..50}; do history -d 1030; done
Personal tools