Longterm bash history with advanced search and select.
Manages a comprehensive history file that allows searching and rerunning commands according to executed command, working directory, time run, user, or host.
- h[!] [CONTEXT] [TIMESPEC] [--] [SEARCH]...
- Search history for pattern
- dh[!] [CONTEXT] [TIMESPEC] [--] [SEARCH]...
- Show history of commands in this directory and subdirectories and optionally filter with pattern
- ldh[!] [CONTEXT] [TIMESPEC] [--] [SEARCH]...
- Show history of commands in this directory only and optionally filter with pattern
SEARCH matches the executed command.
It is interpreted as a
gawk regular expression.
Multiple SEARCH arguments are joined with
TIMESPEC matches the timestamp and
is an argument of the form "[START..END]", (note the square brackets).
START and END are strings understood by
A single day may be specified by "[DATE]".
CONTEXT is an argument of the form "USER@HOST:DIRECTORY" or "USER@HOST::DIRECTORY", where each field is optional. "@" is used to specify user or host filters. ":" is used to specify a directory filter. "::" may be used instead to exclude subdirectories.
All three commands allow selecting from the 10 most recent entries
matching the filters by adding
! to the command (ex.
The selected command may be edited before it is executed.
The following command is also provided:
- cd! [CONTEXT] [TIMESPEC] [--] [SEARCH]
- Select from recent working directories and optionally filter with pattern
View all history
View all commands matching the string
View all commands run in this directory recursively
View all commands run in this directory only
Select and edit from the most recent commands run in this directory only
View all commands starting with
View all commands run yesterday containing
h [yesterday] bar
View all commands run last week
h [14 days ago..7 days ago]
View all commands run this month
h [1 month ago..]
View all commands by user
View all commands run on hostname
View all commands containing the string
h -- @host
View all commands run
View all commands run in
View all commands run in the parent directory recursively
Select from the most recent working directory locations
Select from the most recent working directory locations running
Select from the most recent working directory locations in
$ALL_HISTORY_FILE- location of history file; default
history.sh in your .*rc file.
history - v1.0
Copyright (C) 2014 Mara Kim, Kris Mcgary
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.